Skip to content

Commit edbcd5d

Browse files
address the comments
1 parent 8c01429 commit edbcd5d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

tools/spectral/ipa/__tests__/eachCustomMethodMustUseCamelCase.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ testRule('xgen-IPA-109-custom-method-must-use-camel-case', [
3939
'/a/{exampleId}:method_name': {},
4040
'/a:method_name': {},
4141
'/a/{exampleId}:': {},
42-
'/a:': {}
42+
'/a:': {},
4343
},
4444
},
4545
errors: [

tools/spectral/ipa/rulesets/functions/eachCustomMethodMustUseCamelCase.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { casing } from '@stoplight/spectral-functions';
55
const RULE_NAME = 'xgen-IPA-109-custom-method-must-use-camel-case';
66
const ERROR_MESSAGE = 'The custom method name must use camelCase format.';
77

8-
98
export default (input, opts, { path }) => {
109
// Extract the path key (e.g., '/a/{exampleId}:method') from the JSONPath.
1110
let pathKey = path[1];
@@ -18,11 +17,10 @@ export default (input, opts, { path }) => {
1817

1918
let methodName = getCustomMethodName(pathKey);
2019
if (methodName.length === 0 || methodName.trim().length === 0) {
21-
return [{ message: "Custom method name cannot be empty or blank." }];
20+
return [{ message: 'Custom method name cannot be empty or blank.' }];
2221
}
2322

24-
const isCamelCase = casing(methodName, { type: 'camel', disallowDigits: true });
25-
if (isCamelCase) {
23+
if (casing(methodName, { type: 'camel', disallowDigits: true })) {
2624
return [{ message: `${ERROR_MESSAGE} Method name: ${methodName}.` }];
2725
}
2826
};

0 commit comments

Comments
 (0)