From c4fb4e37e674d3be85307a9efad766daf71cf1b1 Mon Sep 17 00:00:00 2001 From: Ryuichi Saito Date: Tue, 12 Jul 2016 07:55:31 -0700 Subject: [PATCH] Some rule name changes --- oclint-driver/main_docgen.cpp | 2 ++ .../rules/basic/MisplacedNullCheckRule.cpp | 7 ++++- .../basic/ReturnFromFinallyBlockRule.cpp | 2 +- .../rules/cocoa/ObjCVerifyIsEqualHashRule.cpp | 2 +- .../cocoa/ObjCVerifyMustCallSuperRule.cpp | 11 +++++--- .../cocoa/ObjCVerifyProhibitedCallRule.cpp | 8 +++--- .../cocoa/ObjCVerifyProtectedMethodRule.cpp | 2 +- .../ObjCVerifySubclassMustImplementRule.cpp | 11 +++++--- ...structorShouldBeVirtualOrProtectedRule.cpp | 12 ++++++++- ...redSwitchStatementsDontNeedDefaultRule.cpp | 12 ++++++++- ...faultLabelNotLastInSwitchStatementRule.cpp | 12 ++++++++- .../ObjCAssignIvarOutsideAccessorsRule.cpp | 5 ++++ .../rules/convention/PreferEarlyExitRule.cpp | 7 ++++- .../SwitchStatementsShouldHaveDefaultRule.cpp | 12 ++++++++- .../migration/ObjCBoxedExpressionsRule.cpp | 2 +- .../migration/ObjCContainerLiteralsRule.cpp | 2 +- .../migration/ObjCNSNumberLiteralsRule.cpp | 2 +- .../migration/ObjCObjectSubscriptingRule.cpp | 2 +- .../cocoa/ObjCVerifyIsEqualHashRuleTest.cpp | 2 +- .../cocoa/ObjCVerifyMustCallSuperRuleTest.cpp | 6 ++--- .../ObjCVerifyProhibitedCallRuleTest.cpp | 26 +++++++++---------- .../ObjCVerifyProtectedMethodRuleTest.cpp | 2 +- ...bjCVerifySubclassMustImplementRuleTest.cpp | 4 +-- ...witchStatementsDontNeedDefaultRuleTest.cpp | 2 +- ...tLabelNotLastInSwitchStatementRuleTest.cpp | 2 +- .../convention/PreferEarlyExitRuleTest.cpp | 2 +- ...tchStatementsShouldHaveDefaultRuleTest.cpp | 2 +- .../ObjCBoxedExpressionsRuleTest.cpp | 2 +- .../ObjCContainerLiteralsRuleTest.cpp | 2 +- .../ObjCNSNumberLiteralsRuleTest.cpp | 2 +- .../ObjCObjectSubscriptingRuleTest.cpp | 2 +- 31 files changed, 118 insertions(+), 51 deletions(-) diff --git a/oclint-driver/main_docgen.cpp b/oclint-driver/main_docgen.cpp index e84579b9..d094e459 100644 --- a/oclint-driver/main_docgen.cpp +++ b/oclint-driver/main_docgen.cpp @@ -125,6 +125,8 @@ void writeRuleToCategory(ofstream& out, oclint::RuleBase* rule) out << "**Since: " << rule->since() << "**" << endl << endl; + out << "**Name: " << rule->name() << "**" << endl << endl; + out << rule->description() << endl << endl; out << "This rule is defined by the following class: " diff --git a/oclint-rules/rules/basic/MisplacedNullCheckRule.cpp b/oclint-rules/rules/basic/MisplacedNullCheckRule.cpp index 8b4ef519..c2e3a175 100644 --- a/oclint-rules/rules/basic/MisplacedNullCheckRule.cpp +++ b/oclint-rules/rules/basic/MisplacedNullCheckRule.cpp @@ -87,7 +87,7 @@ class MisplacedNullCheckRule : public MisplacedNullCheckBaseRule virtual const std::string description() const override { return "The null check is misplaced. " - "In C and C++, sending a message to a null pointer could crash the app. " + "In C and C++, sending a message to a null pointer could crash the program. " "When null is misplaced, either the check is useless or it's incorrect."; } @@ -160,6 +160,11 @@ class MisplacedNilCheckRule : public MisplacedNullCheckBaseRule "But code readers may be confused about the misplaced nil check."; } + virtual const std::string fileName() const override + { + return "MisplacedNullCheckRule.cpp"; + } + virtual const std::string example() const override { return R"rst( diff --git a/oclint-rules/rules/basic/ReturnFromFinallyBlockRule.cpp b/oclint-rules/rules/basic/ReturnFromFinallyBlockRule.cpp index 86fd3353..bf667c57 100644 --- a/oclint-rules/rules/basic/ReturnFromFinallyBlockRule.cpp +++ b/oclint-rules/rules/basic/ReturnFromFinallyBlockRule.cpp @@ -50,7 +50,7 @@ class ReturnFromFinallyBlockRule : public AbstractASTVisitorRule public: virtual const string name() const override { - return "use early exits and continue"; + return "prefer early exits and continue"; + } + + virtual const string identifier() const override + { + return "PreferEarlyExit"; } virtual int priority() const override diff --git a/oclint-rules/rules/convention/SwitchStatementsShouldHaveDefaultRule.cpp b/oclint-rules/rules/convention/SwitchStatementsShouldHaveDefaultRule.cpp index 0ab5ebc4..3f33a199 100644 --- a/oclint-rules/rules/convention/SwitchStatementsShouldHaveDefaultRule.cpp +++ b/oclint-rules/rules/convention/SwitchStatementsShouldHaveDefaultRule.cpp @@ -11,7 +11,12 @@ class SwitchStatementsShouldHaveDefaultRule : public: virtual const string name() const override { - return "switch statements should have default"; + return "missing default in switch statements"; + } + + virtual const string identifier() const override + { + return "MissingDefaultStatement"; } virtual int priority() const override @@ -35,6 +40,11 @@ class SwitchStatementsShouldHaveDefaultRule : return "Switch statements should have a default statement."; } + virtual const std::string fileName() const override + { + return "SwitchStatementsShouldHaveDefaultRule.cpp"; + } + virtual const std::string example() const override { return R"rst( diff --git a/oclint-rules/rules/migration/ObjCBoxedExpressionsRule.cpp b/oclint-rules/rules/migration/ObjCBoxedExpressionsRule.cpp index 45c9b5c6..8ba0efc7 100644 --- a/oclint-rules/rules/migration/ObjCBoxedExpressionsRule.cpp +++ b/oclint-rules/rules/migration/ObjCBoxedExpressionsRule.cpp @@ -80,7 +80,7 @@ class ObjCBoxedExpressionsRule : public AbstractASTVisitorRule @end diff --git a/oclint-rules/test/cocoa/ObjCVerifyProtectedMethodRuleTest.cpp b/oclint-rules/test/cocoa/ObjCVerifyProtectedMethodRuleTest.cpp index da38c7b8..697122c7 100644 --- a/oclint-rules/test/cocoa/ObjCVerifyProtectedMethodRuleTest.cpp +++ b/oclint-rules/test/cocoa/ObjCVerifyProtectedMethodRuleTest.cpp @@ -23,7 +23,7 @@ TEST(ObjCVerifyProtectedMethodRule, PropertyTest) { ObjCVerifyProtectedMethodRule rule; EXPECT_EQ(1, rule.priority()); - EXPECT_EQ("verify protected method", rule.name()); + EXPECT_EQ("calling protected method", rule.name()); EXPECT_EQ("protected method", rule.attributeName()); EXPECT_EQ(LANG_OBJC, rule.supportedLanguages()); EXPECT_EQ("cocoa", rule.category()); diff --git a/oclint-rules/test/cocoa/ObjCVerifySubclassMustImplementRuleTest.cpp b/oclint-rules/test/cocoa/ObjCVerifySubclassMustImplementRuleTest.cpp index 909a838c..0f50485c 100644 --- a/oclint-rules/test/cocoa/ObjCVerifySubclassMustImplementRuleTest.cpp +++ b/oclint-rules/test/cocoa/ObjCVerifySubclassMustImplementRuleTest.cpp @@ -7,7 +7,7 @@ static string testAnnotationBase = "\ @interface Parent \n\ \n\ - (void)someAbstractMethod \n\ - __attribute__((annotate(\"oclint:enforce[subclass must implement]\"))); \n\ + __attribute__((annotate(\"oclint:enforce[abstract method]\"))); \n\ @end \n\ \n\ @interface Child : Parent \n\ @@ -65,7 +65,7 @@ TEST(ObjcVerifySubclassMustImplementRuleTest, PropertyTest) { ObjCVerifySubclassMustImplementRule rule; EXPECT_EQ(1, rule.priority()); - EXPECT_EQ("subclass must implement", rule.name()); + EXPECT_EQ("missing abstract method implementation", rule.name()); EXPECT_EQ("cocoa", rule.category()); } diff --git a/oclint-rules/test/convention/CoveredSwitchStatementsDontNeedDefaultRuleTest.cpp b/oclint-rules/test/convention/CoveredSwitchStatementsDontNeedDefaultRuleTest.cpp index 3d30e408..c71acf20 100644 --- a/oclint-rules/test/convention/CoveredSwitchStatementsDontNeedDefaultRuleTest.cpp +++ b/oclint-rules/test/convention/CoveredSwitchStatementsDontNeedDefaultRuleTest.cpp @@ -6,7 +6,7 @@ TEST(CoveredSwitchStatementsDontNeedDefaultRuleTest, PropertyTest) { CoveredSwitchStatementsDontNeedDefaultRule rule; EXPECT_EQ(3, rule.priority()); - EXPECT_EQ("covered switch statements dont need default", rule.name()); + EXPECT_EQ("unnecessary default statement in covered switch statement", rule.name()); EXPECT_EQ("convention", rule.category()); } diff --git a/oclint-rules/test/convention/DefaultLabelNotLastInSwitchStatementRuleTest.cpp b/oclint-rules/test/convention/DefaultLabelNotLastInSwitchStatementRuleTest.cpp index 2d04364b..f0de6a0d 100644 --- a/oclint-rules/test/convention/DefaultLabelNotLastInSwitchStatementRuleTest.cpp +++ b/oclint-rules/test/convention/DefaultLabelNotLastInSwitchStatementRuleTest.cpp @@ -6,7 +6,7 @@ TEST(DefaultLabelNotLastInSwitchStatementRuleTest, PropertyTest) { DefaultLabelNotLastInSwitchStatementRule rule; EXPECT_EQ(3, rule.priority()); - EXPECT_EQ("default label not last in switch statement", rule.name()); + EXPECT_EQ("ill-placed default label in switch statement", rule.name()); EXPECT_EQ("convention", rule.category()); } diff --git a/oclint-rules/test/convention/PreferEarlyExitRuleTest.cpp b/oclint-rules/test/convention/PreferEarlyExitRuleTest.cpp index 73ae1cd0..d7ee3dab 100644 --- a/oclint-rules/test/convention/PreferEarlyExitRuleTest.cpp +++ b/oclint-rules/test/convention/PreferEarlyExitRuleTest.cpp @@ -103,7 +103,7 @@ TEST_F(PreferEarlyExitRuleTest, PropertyTest) { PreferEarlyExitRule rule; EXPECT_EQ(3, rule.priority()); - EXPECT_EQ("use early exits and continue", rule.name()); + EXPECT_EQ("prefer early exits and continue", rule.name()); EXPECT_EQ("convention", rule.category()); } diff --git a/oclint-rules/test/convention/SwitchStatementsShouldHaveDefaultRuleTest.cpp b/oclint-rules/test/convention/SwitchStatementsShouldHaveDefaultRuleTest.cpp index f2027cb2..af57216e 100644 --- a/oclint-rules/test/convention/SwitchStatementsShouldHaveDefaultRuleTest.cpp +++ b/oclint-rules/test/convention/SwitchStatementsShouldHaveDefaultRuleTest.cpp @@ -6,7 +6,7 @@ TEST(SwitchStatementsShouldHaveDefaultRuleTest, PropertyTest) { SwitchStatementsShouldHaveDefaultRule rule; EXPECT_EQ(3, rule.priority()); - EXPECT_EQ("switch statements should have default", rule.name()); + EXPECT_EQ("missing default in switch statements", rule.name()); EXPECT_EQ("convention", rule.category()); } diff --git a/oclint-rules/test/migration/ObjCBoxedExpressionsRuleTest.cpp b/oclint-rules/test/migration/ObjCBoxedExpressionsRuleTest.cpp index f053df04..043214f7 100644 --- a/oclint-rules/test/migration/ObjCBoxedExpressionsRuleTest.cpp +++ b/oclint-rules/test/migration/ObjCBoxedExpressionsRuleTest.cpp @@ -36,7 +36,7 @@ TEST(ObjCBoxedExpressionsRuleTest, PropertyTest) { ObjCBoxedExpressionsRule rule; EXPECT_EQ(3, rule.priority()); - EXPECT_EQ("replace with boxed expression", rule.name()); + EXPECT_EQ("use boxed expression", rule.name()); EXPECT_EQ("migration", rule.category()); } diff --git a/oclint-rules/test/migration/ObjCContainerLiteralsRuleTest.cpp b/oclint-rules/test/migration/ObjCContainerLiteralsRuleTest.cpp index 3125127c..010b9404 100644 --- a/oclint-rules/test/migration/ObjCContainerLiteralsRuleTest.cpp +++ b/oclint-rules/test/migration/ObjCContainerLiteralsRuleTest.cpp @@ -38,7 +38,7 @@ TEST(ObjCContainerLiteralsRuleTest, PropertyTest) { ObjCContainerLiteralsRule rule; EXPECT_EQ(3, rule.priority()); - EXPECT_EQ("replace with container literal", rule.name()); + EXPECT_EQ("use container literal", rule.name()); EXPECT_EQ("migration", rule.category()); } diff --git a/oclint-rules/test/migration/ObjCNSNumberLiteralsRuleTest.cpp b/oclint-rules/test/migration/ObjCNSNumberLiteralsRuleTest.cpp index d65de72a..ccaa9c1f 100644 --- a/oclint-rules/test/migration/ObjCNSNumberLiteralsRuleTest.cpp +++ b/oclint-rules/test/migration/ObjCNSNumberLiteralsRuleTest.cpp @@ -33,7 +33,7 @@ TEST(ObjCNSNumberLiteralsRuleTest, PropertyTest) { ObjCNSNumberLiteralsRule rule; EXPECT_EQ(3, rule.priority()); - EXPECT_EQ("replace with number literal", rule.name()); + EXPECT_EQ("use number literal", rule.name()); EXPECT_EQ("migration", rule.category()); } diff --git a/oclint-rules/test/migration/ObjCObjectSubscriptingRuleTest.cpp b/oclint-rules/test/migration/ObjCObjectSubscriptingRuleTest.cpp index 85af3d76..5ffb0bbf 100644 --- a/oclint-rules/test/migration/ObjCObjectSubscriptingRuleTest.cpp +++ b/oclint-rules/test/migration/ObjCObjectSubscriptingRuleTest.cpp @@ -50,7 +50,7 @@ TEST(ObjCObjectSubscriptingRuleTest, PropertyTest) { ObjCObjectSubscriptingRule rule; EXPECT_EQ(3, rule.priority()); - EXPECT_EQ("replace with object subscripting", rule.name()); + EXPECT_EQ("use object subscripting", rule.name()); EXPECT_EQ("migration", rule.category()); }