Wiki

Changes between Initial Version and Version 1 of CodeRefactoringWarningsEnum

Show
Ignore:
Timestamp:
01/13/09 21:38:14 (16 years ago)
Author:
gauthier
Comment:

@Chuck: I prefer less features rather than more dupes in the code base, please stop ;)

Legend:

Unmodified
Added
Removed
Modified
  • CodeRefactoringWarningsEnum

    v1 v1  
     1Please look at theses error messages, find duplicates, find a english readable enumeration member name and put it in the enum at the bottom of the code. 
     2 
     3If few of you do this, there will be the base for cobra warning refactoring, thanks. 
     4 
     5{{{ 
     6""" purpose: refactor this ("grep -rn .warning( *.cobra " from r1903):  
     7BinaryOpExpr.cobra:277:                                 .compiler.warning(this, 'Setting a parameter ("[leftName]") to a class variable ("[rightName]") is often a mistake. You may want to reverse the assignment.') 
     8""" 
     9#BinaryOpExpr.cobra:534:                                                .compiler.warning(this, 'Both the left and right sides of "[opName]" are value types ("[leftType.name]" and "[rightType.name]"), but "[opName]" applies to reference types. Use "[altName]" instead.') 
     10""" 
     11BinaryOpExpr.cobra:537:                                         .compiler.warning(this, 'The left side of "[opName]" is a value type ("[leftType.name]") while the right side is an incompatible reference type ("[rightType.name]").') 
     12BinaryOpExpr.cobra:539:                                         .compiler.warning(this, 'The right side of "[opName]" is a value type ("[rightType.name]") while the left side is an incompatible reference type ("[leftType.name]").')                                          
     13BinaryOpExpr.cobra:614:                         .compiler.warning(this, 'An explicit "this" literal is unnecessary for accessing members of the current object. You can remove "this".') 
     14BinaryOpExpr.cobra:616:                         .compiler.warning(this, 'An explicit dot (".") is unnecessary for accessing underscored members of the current object. You can remove ".".') 
     15BinaryOpExpr.cobra:673:                         .compiler.warning(this, 'The result of "[member.name]" should be used in an expression such as assignment or passing arguments (as indicated by its MustUseResult attribute).') 
     16BinaryOpExpr.cobra:744:                                         .compiler.warning(this, 'The expression is always of type "[.right.toCobraSource]".') 
     17BinaryOpExpr.cobra:753:                                         .compiler.warning(this, 'The expression will always be of type "[.right.toCobraSource]" when not nil. You can just check for not nil by removing "inherits [.right.toCobraSource]".') 
     18BinaryOpExpr.cobra:761:                                                                 .compiler.warning(this, 'The expression is always of type "[.right.toCobraSource]".') 
     19BinaryOpExpr.cobra:765:                                                         .compiler.warning(this, 'The expression (of type "[leftType.name]") is never of type "[.right.toCobraSource]".') 
     20BinaryOpExpr.cobra:772:                                         .compiler.warning(this, 'The expression (of type "[leftType.name]") is never of type "[.right.toCobraSource]".') 
     21BinaryOpExpr.cobra:834:                                 .compiler.warning(this, 'The given expression is already a "[_rightTypeExpr.toCobraSource]", but nilable. You can just use "to !".') 
     22BinaryOpExpr.cobra:837:                                 .compiler.warning(this, 'The given expression is already a "[_left.type.name]", but not nilable. You can just use "to ?".') 
     23BinaryOpExpr.cobra:839:                         .compiler.warning(this, 'The given expression is already a "[_rightTypeExpr.toCobraSource]" so the typecast is redundant. You can remove it.') 
     24Boxes.cobra:1092:                       .compiler.warning(this, 'When attributes are declared, they should be suffixed with "Attribute".') 
     25CobraParser.cobra:37:   def warning(we as CobraWarning) 
     26""" 
     27#CobraParser.cobra:197:                         _warning('File is empty.') 
     28#CobraParser.cobra:199:                         _warning('File is completely blank.') 
     29#CobraParser.cobra:450:                 _warning('Colons are not used to start indented blocks. You can remove the colon.') 
     30#CobraParser.cobra:488:                 _warning('Colons are not used to start indented blocks. You can remove the colon.') 
     31""" 
     32CobraParser.cobra:592:                          _warning(msg) 
     33CobraParser.cobra:793:                                  _warning(.last, '"fake" has been deprecated. Use "extern" instead.')  # deprecated on 2008-10-03 
     34CobraParser.cobra:1214:                 _warning('Encountered "pass" in a class that already has declared members.')  # TODO: change to an error 
     35""" 
     36#CobraParser.cobra:1264:                                _warning('Colons are not used to start indented blocks. You can remove the colon.') 
     37""" 
     38CobraParser.cobra:1266:                         _warning('Colons are not required with invariants. You can remove the colon.') 
     39CobraParser.cobra:1315:                 _warning(opener, 'Unnecessary parentheses. You can remove them.') 
     40CobraParser.cobra:1428:                         _warning(opener, 'Unnecessary parentheses. You can remove them.') 
     41CobraParser.cobra:1529:                                 _warning(.peek, 'Interface `test` sections are parsed, but ignored. In the future, classes will acquire the tests of the interfaces they implement.') 
     42CobraParser.cobra:1665:                                 _warning(.peek, 'Interface `test` sections are parsed, but ignored. In the future, classes will acquire the tests of the interfaces they implement.') 
     43CobraParser.cobra:1716:                         _warning('The first parameter is "self" which may be a Python carry-over on your part. Cobra does not require that (and calls it "this" anyway).') 
     44CobraParser.cobra:1859:                                 _warning('More than 100 lines of code ([codePart.statements.count] toplevel statements) in method [fullName].')  
     45CobraParser.cobra:2415:                         _warning('Colons are not used to put a target statement on the same line. Use a comma (,) instead.') 
     46CobraParser.cobra:2588:                                 _warning(expr.token, 'Unnecessary parentheses around expression. You can remove them.') 
     47CobraParser.cobra:3088:                         _warning('Assuming empty dictionary, but please use "{:}" for empty dictionary or "{,}" for empty set') 
     48CobraParser.cobra:3490: def _warning(msg as String) 
     49CobraParser.cobra:3491:         _warning(.last, msg) 
     50CobraParser.cobra:3493: def _warning(token as IToken, msg as String) 
     51CobraParser.cobra:3494:         _warningRecorder.warning(CobraWarning(_fileName, token, msg)) 
     52""" 
     53#Compiler.cobra:1187:                           .warning(CobraWarning(fileName, nil, 'Cannot write source code corrections due to: [exc.message] ([exc.getType.name]).')) 
     54""" 
     55Compiler.cobra:1348:    def warning(node as ISyntaxNode, msg as String) 
     56Compiler.cobra:1350:            .warning(CobraWarning(node.token, msg)) 
     57Compiler.cobra:1352:    def warning(cw as CobraWarning) 
     58Expr.cobra:552:                         .compiler.warning(this, 'Unnecessary parentheses. You can remove them.') 
     59Expr.cobra:2034:                        .compiler.warning(this, 'The value nil will always evaluate to false.') 
     60Expr.cobra:2065:                                .compiler.warning(_notExpr, 'The expression "[_notExpr.toCobraSource]" (of type "[type.name]") will never evaluate to false because the expression is not nilable. [hint]') 
     61Expr.cobra:2075:                                .compiler.warning(this, 'The expression "[_expr.toCobraSource]" (of type "[type.name]") will always evaluate to true because it is not nilable. [hint]') 
     62Expr.cobra:2957:                        .compiler.warning(this, 'The given expression is already nilable so "to ?" is redundant. You can remove it.')  # TODO: needs test case 
     63Expr.cobra:2988:                        .compiler.warning(this, 'The given expression is already non-nilable so "to !" is redundant. You can remove it.') # TODO: needs test case 
     64InstallFromWorkspace.cobra:156: def warning(msg) 
     65""" 
     66#Members.cobra:215:                             .compiler.warning(this, 'Duplicate modifier "[name]". You can remove it.') 
     67""" 
     68Members.cobra:354:                              .compiler.warning(this, 'Cannot locate a single invoke method of "[_handlerType.name]".') 
     69Members.cobra:358:                              .compiler.warning(this, 'Cannot determine parameters of event "[.name]".') 
     70Members.cobra:831:                              .compiler.warning(local, 'The value of variable "[local.name]" is never used.') 
     71Members.cobra:1080:             if .name == '__init__', .compiler.warning(this, 'Initializers are named "init" with no surrounding underscores.') 
     72NameSpace.cobra:192:                    .compiler.warning(this, 'Namespace names should start with an uppercase letter in order to avoid collisions with other identifiers such as arguments and local variables.') 
     73NameSpace.cobra:210:                                            .compiler.warning(this, 'Multiple namespaces in "[.fullName]" differ only by case: ' + namesMsgPart) 
     74NameSpace.cobra:217:                                            else, .compiler.warning(this, msg) 
     75Node.cobra:1174:        def warning(node as ISyntaxNode, msg as String)  # TODO: move to IWarningRecorder 
     76Statements.cobra:973:                                   .compiler.warning(this, unThis) 
     77Statements.cobra:977:                                   .compiler.warning(this, unThis) 
     78TypeProxies.cobra:220:                          # TODO: .compiler.warning(msg) 
     79TypeProxies.cobra:273:                          # TODO: .compiler.warning(msg) 
     80""" 
     81 
     82enum WarningMessage 
     83        FoundDuplicateModifier                       # 'Duplicate modifier "[name]". You can remove it.' 
     84        FoundEmptyFile                               # 'File is empty.' / 'File is completely blank.' 
     85        FoundBeginBlockLineEndedWithColon            # 'Colons are not used to start indented blocks. You can remove the colon.' 
     86        ExceptionWhileSourceCorrection               # 'Cannot write source code corrections due to: [exc.message] ([exc.getType.name]).' 
     87        # 'Setting a parameter ("[leftName]") to a class variable ("[rightName]") is often a mistake. You may want to reverse the assignment.' 
     88        IncorrectOperatorUseWithValueTypes           # 'Both the left and right sides of "[opName]" are value types ("[leftType.name]" and "[rightType.name]"), but "[opName]" applies to reference types. Use "[altName]" instead.' 
     89         
     90}}}