-
Notifications
You must be signed in to change notification settings - Fork 67
Guideline recategorization #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rvermeulen
merged 43 commits into
github:main
from
rvermeulen:guideline-recategorization
Dec 2, 2022
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
8647dd4
Add rule category to rule meta data
rvermeulen aa0a835
Add support for guideline recategorizations
rvermeulen ebf64e6
Move coding standards config processing script
rvermeulen 86bc3f8
Format generated exclusion files
rvermeulen 8738fe1
Add support for generating files for multiple packages
rvermeulen 1d4b947
Address incorrect format exclusion files
rvermeulen aeab8c3
Switch to GH managed CodeQL cli
rvermeulen acb0ff1
Address race condition in package file generation
rvermeulen 0bdf011
Address incorrect formatting
rvermeulen 9edb1da
Use the effective category in the exclusion process
rvermeulen c33952e
Add `isExcluded/3` that includes the reason for exclusion
rvermeulen 61c33be
Exclude queries with effective category disapplied.
rvermeulen 703c3e9
Add test case for disapplied queries.
rvermeulen 87d7d82
Add guideline recategorization post processing script
rvermeulen a4d2e3a
Add tag with original category
rvermeulen a0a40cd
Handle schema validation exception
rvermeulen 8b7be75
Properly handle json and yml decoding errors.
rvermeulen 4f18053
Add unit tests for the recategorization script.
rvermeulen 4c5407b
Add workflow to run recategorize tests
rvermeulen 8e91bcc
Add missing deviation analysis report tables
rvermeulen 993e1b2
Format fixes
rvermeulen a759166
Add guideline recategorization plan description
rvermeulen ea455ed
Address CodeQL module import issues
rvermeulen 3a480e9
Include the original rule category.
rvermeulen 7272744
Remove unused imports
rvermeulen bc46b75
Address incorrect type annotations
rvermeulen c5ea428
Address returning CSV reader on closed file
rvermeulen 81240ca
Add create database method
rvermeulen 30a47e0
Add guideline recategorization report generation
rvermeulen 77b5611
Add unit test for guideline recategorization report generation
rvermeulen 9e1be4d
Add distinguishing icon to tooling unit tests workflow
rvermeulen 5571453
Add analysis report unit tests to testing workflow
rvermeulen 40f8ee6
Add minimal test case for deviation report generation
rvermeulen cbd2fcf
Add shared components to code scanning pack
rvermeulen 79839c4
Add guideline recategorization scripts to code scanning pack
rvermeulen ea3f111
Add changenote for guideline recategorization scripts
rvermeulen fab2b27
Add guideline recategorization design document.
rvermeulen a85c6ff
Clarify the category of non Misra standard guidelines.
rvermeulen 60b3115
Apply wording suggestion from code review
rvermeulen 36b466e
Remove remnant of the GRP proposal
rvermeulen 097d091
Update the TOC
rvermeulen bdbaa07
Update document management section
rvermeulen be60c7b
Clarify GRP for non-MISRA standards
rvermeulen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: 🧰 Tooling unit tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- "rc/**" | ||
- next | ||
pull_request: | ||
branches: | ||
- main | ||
- "rc/**" | ||
- next | ||
|
||
jobs: | ||
prepare-supported-codeql-env-matrix: | ||
name: Prepare supported CodeQL environment matrix | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.export-supported-codeql-env-matrix.outputs.matrix }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Export supported CodeQL environment matrix | ||
id: export-supported-codeql-env-matrix | ||
run: | | ||
echo "::set-output name=matrix::$( | ||
jq --compact-output '.supported_environment | {include: .}' supported_codeql_configs.json | ||
)" | ||
|
||
analysis-report-tests: | ||
name: Run analysis report tests | ||
needs: prepare-supported-codeql-env-matrix | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(needs.prepare-supported-codeql-env-matrix.outputs.matrix) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install Python dependencies | ||
run: pip install -r scripts/reports/requirements.txt | ||
|
||
- name: Cache CodeQL | ||
id: cache-codeql | ||
uses: actions/cache@v2.1.3 | ||
with: | ||
path: ${{ github.workspace }}/codeql_home | ||
key: codeql-home-${{ matrix.os }}-${{ matrix.codeql_cli }}-${{ matrix.codeql_standard_library }} | ||
|
||
- name: Install CodeQL | ||
if: steps.cache-codeql.outputs.cache-hit != 'true' | ||
uses: ./.github/actions/install-codeql | ||
with: | ||
codeql-cli-version: ${{ matrix.codeql_cli }} | ||
codeql-stdlib-version: ${{ matrix.codeql_standard_library }} | ||
codeql-home: ${{ github.workspace }}/codeql_home | ||
add-to-path: false | ||
|
||
- name: Run PyTest | ||
env: | ||
CODEQL_HOME: ${{ github.workspace }}/codeql_home | ||
run: | | ||
PATH=$PATH:$CODEQL_HOME/codeql | ||
pytest scripts/reports/analysis_report_test.py | ||
|
||
recategorization-tests: | ||
name: Run Guideline Recategorization tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install Python dependencies | ||
run: pip install -r scripts/guideline_recategorization/requirements.txt | ||
|
||
- name: Run PyTest | ||
run: | | ||
pytest scripts/guideline_recategorization/recategorize_test.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
change_notes/2022-11-07-add-guideline-recategorization-scripts.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- Add the Python scripts under `scripts/guideline_recategorization` and the JSON schemas under `schemas`. | ||
- Add the Python scripts under `scripts/shared` relied upon by the analysis report generation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* A module for runtime configuration settings specified in a `conding-standards.yml` file. | ||
*/ | ||
|
||
import cpp | ||
import semmle.code.cpp.XML | ||
import codingstandards.cpp.exclusions.RuleMetadata | ||
import codingstandards.cpp.deviations.Deviations | ||
|
||
/** A `coding-standards.xml` configuration file (usually generated from an YAML configuration file). */ | ||
class CodingStandardsFile extends XMLFile { | ||
CodingStandardsFile() { | ||
this.getBaseName() = "coding-standards.xml" and | ||
// Must be within the users source code. | ||
exists(this.getRelativePath()) | ||
} | ||
} | ||
|
||
class CodingStandardsConfigSection extends XMLElement { | ||
CodingStandardsConfigSection() { getParent() instanceof CodingStandardsConfig } | ||
} | ||
|
||
/** A "Coding Standards" configuration file */ | ||
class CodingStandardsConfig extends XMLElement { | ||
CodingStandardsConfig() { | ||
any(CodingStandardsFile csf).getARootElement() = this and | ||
this.getName() = "codingstandards" | ||
} | ||
|
||
/** Get a section in this configuration file. */ | ||
CodingStandardsConfigSection getASection() { result.getParent() = this } | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.