
In some cases, the `rule.adoc` at root of a rule is never included anywhere and thus is dead code. It's a maintenance cost by itself, but also it misses opportunities to inline code that seems used by two documents when in fact only one document is actually rendered. And this missed opportunity, in turn, stops us from applying the correct language tag on the code samples.
53 lines
1.1 KiB
Plaintext
53 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
By convention, a file that exports only one class, function, or constant should be named for that class, function or constant. Anything else may confuse maintainers.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
// file path: myclass.js -- Noncompliant
|
|
class MyClass {
|
|
// ...
|
|
}
|
|
export default MyClass;
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
// file path: MyClass.js
|
|
class MyClass {
|
|
// ...
|
|
}
|
|
export default MyClass;
|
|
----
|
|
|
|
=== Exceptions
|
|
|
|
Case, dots ( ``++.++`` ), underscores ( ``++_++`` ) and dashes (``++-++``) are ignored from the name comparison. Postfixes in filenames like ``++.dev++`` in ``++my.class.dev.js++`` are also ignored.
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Rename this file to "xxx".
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== relates to: S3259
|
|
|
|
=== on 14 Jul 2016, 16:09:25 Ann Campbell wrote:
|
|
https://github.com/google/error-prone/blob/master/docs/bugpattern/ClassName.md
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|