Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Update rule package schema #53

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
merged 9 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 c/cert/src/rules/ENV33-C/DoNotCallSystem.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @problem.severity error
* @tags external/cert/id/env33-c
* security
* external/cert/obligtion/rule
* external/cert/obligation/rule
*/

import cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EXP37-C: Pass the correct number of arguments to the POSIX open function.
# EXP37-C: Pass the correct number of arguments to the POSIX open function

This query implements the CERT-C rule EXP37-C:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @id c/cert/call-posix-open-with-correct-argument-count
* @name EXP37-C: Pass the correct number of arguments to the POSIX open function.
* @name EXP37-C: Pass the correct number of arguments to the POSIX open function
* @description A third argument should be passed to the POSIX function open() when and only when
* creating a new file.
* @kind problem
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EXP37-C: Do not pass arguments with an incompatible count or type to a function.
# EXP37-C: Do not pass arguments with an incompatible count or type to a function

This query implements the CERT-C rule EXP37-C:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @id c/cert/do-not-call-functions-with-incompatible-arguments
* @name EXP37-C: Do not pass arguments with an incompatible count or type to a function.
* @name EXP37-C: Do not pass arguments with an incompatible count or type to a function
* @description The arguments passed to a function must be compatible with the function's
* parameters.
* @kind problem
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* @id c/cert/do-not-alternately-io-from-a-stream-without-positioning
* @name FIO39-C: Do not alternately input and output from a stream without an intervening flush or positioning call
* @description
* @description Do not alternately input and output from a stream without an intervening flush or
* positioning call. This may result in undefined behavior.
* @kind problem
* @precision very-high
* @problem.severity error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* @id c/cert/close-files-when-they-are-no-longer-needed
* @name FIO42-C: Close files when they are no longer needed
* @description
* @description Open files must be closed before the lifetime of the last pointer to the file-object
* has ended to prevent resource exhaustion and data loss issues.
* @kind problem
* @precision very-high
* @problem.severity error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @id c/cert/undefined-behavior-accessing-a-closed-file
* @name FIO46-C: Do not access a closed file
* @description Do not access a closed file
* @description Do not access a closed file.
* @kind problem
* @precision high
* @problem.severity error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @name RULE-13-3: A full expression containing an increment (++) or decrement (--) operator should have no other
* @description A full expression containing an increment (++) or decrement (--) operator should
* have no other potential side effects other than that caused by the increment or
* decrement operator
* decrement operator.
* @kind problem
* @precision very-high
* @problem.severity warning
Expand Down
2 changes: 1 addition & 1 deletion 2 c/misra/src/rules/RULE-22-6/FileUsedAfterClosed.ql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @id c/misra/file-used-after-closed
* @name RULE-22-6: The value of a pointer to a FILE shall not be used after the associated stream has been closed
* @description A closed FILE is accessed
* @description A closed FILE is accessed.
* @kind problem
* @precision very-high
* @problem.severity error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @id c/misra/eof-shall-be-compared-with-unmodified-return-values
* @name RULE-22-7: The macro EOF shall only be compared with the unmodified return value from any Standard Library
* @description The macro EOF shall only be compared with the unmodified return value from any
* Standard Library function capable of returning EOF
* Standard Library function capable of returning EOF.
* @kind problem
* @precision high
* @problem.severity error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @name RULE-4-12: Dynamic memory allocation shall not be used
* @description Using dynamic memory allocation and deallocation can result to undefined behavior.
* This query is for the Standard Library Implementation. Any implementation outside it
* will require a separate query under the same directive
* will require a separate query under the same directive.
* @kind problem
* @precision very-high
* @problem.severity error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* @tags external/misra/id/rule-4-8
* readability
* maintainability
* readability
* external/misra/obligation/advisory
*/

Expand Down
4 changes: 2 additions & 2 deletions 4 rule_packages/c/Banned.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"CERT-C": {
"ENV33-C": {
"properties": {
"obligtion": "rule"
"obligation": "rule"
},
"queries": [
{
Expand Down Expand Up @@ -310,7 +310,7 @@
},
"queries": [
{
"description": "Using dynamic memory allocation and deallocation can result to undefined behavior. This query is for the Standard Library Implementation. Any implementation outside it will require a separate query under the same directive",
"description": "Using dynamic memory allocation and deallocation can result to undefined behavior. This query is for the Standard Library Implementation. Any implementation outside it will require a separate query under the same directive.",
"kind": "problem",
"name": "Dynamic memory allocation shall not be used",
"precision": "very-high",
Expand Down
4 changes: 2 additions & 2 deletions 4 rule_packages/c/Expressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"description": "The arguments passed to a function must be compatible with the function's parameters.",
"kind": "problem",
"name": "Do not pass arguments with an incompatible count or type to a function.",
"name": "Do not pass arguments with an incompatible count or type to a function",
"precision": "high",
"severity": "error",
"short_name": "DoNotCallFunctionsWithIncompatibleArguments",
Expand All @@ -33,7 +33,7 @@
{
"description": "A third argument should be passed to the POSIX function open() when and only when creating a new file.",
"kind": "problem",
"name": "Pass the correct number of arguments to the POSIX open function.",
"name": "Pass the correct number of arguments to the POSIX open function",
"precision": "high",
"severity": "error",
"short_name": "CallPOSIXOpenWithCorrectArgumentCount",
Expand Down
8 changes: 4 additions & 4 deletions 8 rule_packages/c/IO1.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
"queries": [
{
"description": "",
"description": "Do not alternately input and output from a stream without an intervening flush or positioning call. This may result in undefined behavior.",
"kind": "problem",
"name": "Do not alternately input and output from a stream without an intervening flush or positioning call",
"precision": "very-high",
Expand All @@ -88,7 +88,7 @@
},
"queries": [
{
"description": "",
"description": "Open files must be closed before the lifetime of the last pointer to the file-object has ended to prevent resource exhaustion and data loss issues.",
"kind": "problem",
"name": "Close files when they are no longer needed",
"precision": "very-high",
Expand All @@ -111,7 +111,7 @@
},
"queries": [
{
"description": "Do not access a closed file",
"description": "Do not access a closed file.",
"kind": "problem",
"name": "Do not access a closed file",
"precision": "high",
Expand All @@ -136,7 +136,7 @@
},
"queries": [
{
"description": "A closed FILE is accessed",
"description": "A closed FILE is accessed.",
"kind": "problem",
"name": "The value of a pointer to a FILE shall not be used after the associated stream has been closed",
"precision": "very-high",
Expand Down
2 changes: 1 addition & 1 deletion 2 rule_packages/c/IO3.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
},
"queries": [
{
"description": "The macro EOF shall only be compared with the unmodified return value from any Standard Library function capable of returning EOF",
"description": "The macro EOF shall only be compared with the unmodified return value from any Standard Library function capable of returning EOF.",
"kind": "problem",
"name": "The macro EOF shall only be compared with the unmodified return value from any Standard Library",
"precision": "high",
Expand Down
3 changes: 1 addition & 2 deletions 3 rule_packages/c/Pointers1.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,7 @@
"short_name": "ObjectWithNoPointerDereferenceShouldBeOpaque",
"tags": [
"readability",
"maintainability",
"readability"
"maintainability"
],
"implementation_scope": {
"description": "This rule considers all cases where a structure or union is referenced as a pointer but has no FieldAccess within a translation unit. Further excluded from this rule are translation units in which the structure or union is declared as a non-pointer variable."
Expand Down
2 changes: 1 addition & 1 deletion 2 rule_packages/c/SideEffects2.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"queries": [
{
"description": "A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator",
"description": "A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator.",
"kind": "problem",
"name": "A full expression containing an increment (++) or decrement (--) operator should have no other",
"precision": "very-high",
Expand Down
105 changes: 100 additions & 5 deletions 105 schemas/rule-package.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"type": "string",
"enum": [
"required",
"rule",
"advisory"
]
}
Expand All @@ -67,6 +66,7 @@
"type": "string"
}
},
"additionalProperties": false,
"required": [
"properties",
"queries",
Expand All @@ -85,6 +85,100 @@
"type": "object",
"patternProperties": {
"^\\w+\\d+-CPP": {
"description": "A coding standard rule",
"type": "object",
"properties": {
"properties": {
"type": "object",
"properties": {
"obligation": {
"type": "string",
"enum": [
"rule"
]
}
},
"required": [
"obligation"
]
},
"queries": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/$defs/query"
}
},
"title": {
"type": "string"
}
},
"required": [
"properties",
"queries",
"title"
],
"additionalProperties": false
}
},
"minProperties": 1
}
}
},
{
"properties": {
"CERT-C": {
"description": "Rules part of the CERT-C standard",
"type": "object",
"patternProperties": {
"^\\w+\\d+-C": {
"description": "A coding standard rule",
"type": "object",
"properties": {
"properties": {
"type": "object",
"properties": {
"obligation": {
"type": "string",
"enum": [
"rule"
]
}
},
"required": [
"obligation"
]
},
"queries": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/$defs/query"
}
},
"title": {
"type": "string"
}
},
"required": [
"properties",
"queries",
"title"
],
"additionalProperties": false
}
},
"minProperties": 1
}
}
},
{
"properties": {
"MISRA-C-2012": {
"description": "Rules part of the MISRA C 2012 standard",
"type": "object",
"patternProperties": {
"^RULE-\\d+-\\d+": {
"description": "A coding standard rule",
"type": "object",
"properties": {
Expand All @@ -95,8 +189,8 @@
"type": "string",
"enum": [
"required",
"rule",
"advisory"
"advisory",
"mandatory"
]
}
},
Expand All @@ -119,7 +213,8 @@
"properties",
"queries",
"title"
]
],
"additionalProperties": false
}
},
"minProperties": 1
Expand All @@ -128,7 +223,7 @@
}
],
"minProperties": 1,
"maxProperties": 2,
"maxProperties": 4,
"$defs": {
"query": {
"$id": "/schemas/query",
Expand Down
2 changes: 1 addition & 1 deletion 2 scripts/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ soupsieve==2.0.1
urllib3==1.26.5
pyyaml==5.4
wheel==0.37.0
jsonschema==3.2.0
jsonschema==4.9.1
marko==1.2.1
Morty Proxy This is a proxified and sanitized view of the page, visit original site.