
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
75 lines
1.2 KiB
Plaintext
75 lines
1.2 KiB
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
With a maximum number of 4 parameters:
|
|
|
|
[source,javascript]
|
|
----
|
|
function doSomething(param1, param2, param3, param4, param5) {
|
|
...
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
function doSomething(param1, param2, param3, param4) {
|
|
...
|
|
}
|
|
----
|
|
|
|
=== Exceptions
|
|
|
|
The rule ignores constructors where parameters are *all* parameter properties:
|
|
|
|
[source,javascript]
|
|
----
|
|
class C {
|
|
constructor(
|
|
private param1: number,
|
|
private param2: boolean,
|
|
private param3: string,
|
|
private param4: string[],
|
|
private param5: number | string
|
|
) {}
|
|
}
|
|
----
|
|
|
|
The rule also ignores Angular component constructors:
|
|
|
|
[source,javascript]
|
|
----
|
|
import { Component } from '@angular/core';
|
|
|
|
@Component({/* ... */})
|
|
class Component {
|
|
constructor(p1, p2, p3, p4, p5) {}
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
* Key: max
|
|
** Description: Maximum authorized number of parameters
|
|
** Default Value: 7
|
|
|
|
|
|
include::../parameters.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|