86 lines
1.4 KiB
Plaintext
86 lines
1.4 KiB
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,dart,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
void doSomething() {
|
|
; // Noncompliant - was used as a kind of TODO marker
|
|
}
|
|
----
|
|
|
|
[source,dart,diff-id=2,diff-type=noncompliant]
|
|
----
|
|
void f() {
|
|
if (complicated.expression.foo()); // Noncompliant - the condition doesn't apply to bar
|
|
bar();
|
|
}
|
|
----
|
|
|
|
[source,dart,diff-id=3,diff-type=noncompliant]
|
|
----
|
|
void f() {
|
|
if (complicated.expression.foo())
|
|
bar();
|
|
else ; // Noncompliant else is empty
|
|
buzz();
|
|
}
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,dart,diff-id=1,diff-type=compliant]
|
|
----
|
|
void doSomething() {
|
|
}
|
|
----
|
|
|
|
[source,dart,diff-id=2,diff-type=compliant]
|
|
----
|
|
void f() {
|
|
if (complicated.expression.foo()) {
|
|
bar();
|
|
}
|
|
}
|
|
----
|
|
|
|
[source,dart,diff-id=3,diff-type=compliant]
|
|
----
|
|
void f() {
|
|
if (complicated.expression.foo())
|
|
bar();
|
|
else
|
|
buzz();
|
|
}
|
|
----
|
|
|
|
== Resources
|
|
|
|
* Dart Docs - https://dart.dev/tools/linter-rules/empty_statements[Dart Linter rule - empty_statements]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
* Unnecessary empty statement.
|
|
|
|
=== Highlighting
|
|
|
|
The `;` character.
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|