Skip to content

Commit 7e4f8e4

Browse files
Caleb McGaryCaleb McGary
authored andcommitted
enhancement: add support for specifying coding standards filename and extension
1 parent f793d14 commit 7e4f8e4

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
deviations:
2+
- rule-id: "A0-1-1"
3+
query-id: "cpp/autosar/useless-assignment"
4+
justification: "This useless assignment is required."
5+
background: |
6+
## Useless assignments
7+
8+
We don't want to use useless assignments because they are useless.
9+
- rule-id: "A0-4-2"
10+
justification: "long double is required for interaction with third-pary libraries."
11+
code-identifier: "a0-4-2-deviation"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
deviations:
2+
- rule-id: "A0-1-2"
3+
justification: |
4+
The return values in this file are not required because ...
5+
path: "nested2"

scripts/deviations/process_coding_standards_config.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ def main():
8787
action='store_true',
8888
help='Skip indexing the configurations and only convert them to XML. Should be used with --save-temps.'
8989
)
90+
parser.add_argument(
91+
'--coding-standards-file',
92+
help='Filename and extension of coding standards deviations file. Default is coding-standards.yml',
93+
required=False,
94+
default="coding-standards.yml"
95+
)
9096
args = parser.parse_args()
9197

9298
if not args.skip_indexing:
@@ -105,8 +111,15 @@ def main():
105111
f"The specified working directory '{args.working_dir}'' does not exist.", file=sys.stderr)
106112
sys.exit(1)
107113

108-
# Find all the coding-standards.yml files, and convert them in place to coding-standards.xml
109-
for path in args.working_dir.rglob('coding-standards.yml'):
114+
# Verify that the coding standards deviations file exists
115+
coding_standards_file = Path(args.coding_standards_file)
116+
if not coding_standards_file.is_file():
117+
print(
118+
f"The specified coding standards deviations file '{args.coding_standards_file}' does not exist", file=sys.stderr)
119+
sys.exit(1)
120+
121+
# Find all coding standards deviations files, and convert them in place to coding-standards.xml
122+
for path in args.working_dir.rglob(args.coding_standards_file):
110123
convert_yaml_file_to_xml(path)
111124

112125
if not args.skip_indexing:

0 commit comments

Comments
 (0)