Си диез / Говнокод #173 Ссылка на оригинал

0

  1. 1
  2. 2
if (a == null == false) {
}

когда проверял чужой код пол часа смотрел пока понял что чувак просто не умеет писать if (а != null)

guest guest, (Updated )

Комментарии (30, +30)

Си диез / Говнокод #129 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
try
{
    ...
    if (obj == null)
    {
        LogManager.GetLogger("Log").Warn(msg);
        throw new SoapException("Object not found", SoapException.ServerFaultCode);
    }
}
catch (Exception ex)
{
    LogManager.GetLogger("Log").Error(msg, ex);
    throw new SoapException("Object not found, SoapException.ServerFaultCode, ex);                
}

guest guest, (Updated )

Комментарии (4, +4)

Си диез / Говнокод #106 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
protected string TryToUpper(string text)
{
      StringBuilder sb = new StringBuilder();
      foreach(char t in text)
      {
      	try
            {
            	sb.Append(t.ToString().ToUpper());
            }
            catch
            {
            	sb.Append(t.ToString());
            }
      }
      return sb.ToString();
}

guest guest, (Updated )

Комментарии (7, +7)

Си диез / Говнокод #101 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
private string parameterName;

public string ParameterName
{
get { return parameterName; }
set { parameterName = value; }
}

И эта куча г... вместо: public string ParameterName {get; set;}

guest guest, (Updated )

Комментарии (70, +70)

Си диез / Говнокод #92 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
  62. 62
  63. 63
  64. 64
  65. 65
public TourResult NextTour()
      {
        TourResult lresult = new TourResult();
        lresult.TourNum = mCurrentTour;
        lresult.IsEnd = false;
        Card.Face[] lCurrFaces = getCurrentTourFace();
        int lMaxFace = 0;
        foreach (Card.Face lFace in lCurrFaces)
        {
          lMaxFace = ((int)lFace) > lMaxFace ? (int)lFace : lMaxFace;
        }
        int lMaxFaceCount = 0;
        int lNotZeroCount = 0;
        foreach (Card.Face lFace in lCurrFaces)
        {
          lMaxFaceCount = (int)lFace == lMaxFace ? lMaxFaceCount + 1 : lMaxFaceCount + 0;
          lNotZeroCount = (int)lFace != 0 ? lNotZeroCount + 1 : lNotZeroCount + 0;
        }

        if (lMaxFaceCount > 1)
        {
          mUnknowTour = mUnknowTour > -1 ? mUnknowTour : mCurrentTour;
          mCurrentTour++;
          lresult.Message = "Одинаковые карты, надо разиграть";
          lresult.PlayerIndex = -1;
          lresult.Face = (Face)lMaxFace;
          return lresult;
        }
        int lMaxFaceIndex;
        for (lMaxFaceIndex = 0; lMaxFaceIndex < lCurrFaces.Length; lMaxFaceIndex++)
        {
          if (((int)lCurrFaces[lMaxFaceIndex]) == lMaxFace)
            break;
        }
        if (lNotZeroCount < 2)
        {
          lresult.Message = "победил";
          lresult.PlayerIndex = lMaxFaceIndex;
          lresult.IsEnd = true;
          return lresult;
        }
        int lPlaerCardsCount = mArr[lMaxFaceIndex].Count;
        if (mUnknowTour > -1)
        {
          for (int i = mUnknowTour; i <= mCurrentTour; i++)
          {
            AddCardsToPlayer(i, lMaxFaceIndex);
          }
          mUnknowTour = -1;
        }
        else
        {
          AddCardsToPlayer(mCurrentTour, lMaxFaceIndex);
        }

        lresult.Message = "загреб краты";
        for (int i = lPlaerCardsCount; i < mArr[lMaxFaceIndex].Count; i++)
        {
          lresult.Message += string.Format(" {0},", GetCardName(mArr[lMaxFaceIndex][i]));
        }

        lresult.PlayerIndex = lMaxFaceIndex;
        mCurrentTour++;
        return lresult;
      }

Говнокод из карточной игры в пьяницу

guest guest, (Updated )

Комментарии (8, +8)