Skip to content

Commit

Permalink
Create rule S6940: Positional parameters must precede keyword paramet…
Browse files Browse the repository at this point in the history
…ers (#3738)

* Create rule S6940

* Put jcl spec

* Address review comment

---------

Co-authored-by: rudy-regazzoni-sonarsource <[email protected]>
Co-authored-by: Rudy Regazzoni <[email protected]>
  • Loading branch information
3 people authored Mar 13, 2024
1 parent c8fc3ff commit a1eebc5
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
23 changes: 23 additions & 0 deletions rules/S6940/jcl/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"title": "Positional parameters must precede keyword parameters",
"type": "BUG",
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"constantCost": "5min"
},
"tags": [
],
"defaultSeverity": "Critical",
"ruleSpecification": "RSPEC-6940",
"sqKey": "S6940",
"scope": "All",
"defaultQualityProfiles": ["Sonar way"],
"quickfix": "unknown",
"code": {
"impacts": {
"RELIABILITY": "HIGH"
},
"attribute": "LOGICAL"
}
}
30 changes: 30 additions & 0 deletions rules/S6940/jcl/rule.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Positional parameters must be specified before any keyword parameters.

== Why is this an issue?

JCL requires positional parameters to be specified before any keyword parameters. Having keyword parameters defined before a positional parameter will trigger a JCL error.

== How to fix it

=== Code examples

==== Noncompliant code example

[source,jcl,diff-id=1,diff-type=noncompliant]
----
//MYJOB JOB CLASS=X,'TRIGGER'
----

==== Compliant solution

[source,text,diff-id=1,diff-type=compliant]
----
//MYJOB JOB 'TRIGGER',CLASS=X
----

== Resources

=== Documentation

* https://www.ibm.com/docs/en/zos/3.1.0?topic=messages-iefc006i[IBM Reference - IEFC006I]
* https://www.ibm.com/docs/en/zos/3.1.0?topic=fields-parameter-field[IBM Reference - Parameter field]
2 changes: 2 additions & 0 deletions rules/S6940/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}

0 comments on commit a1eebc5

Please sign in to comment.