-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify S1874: Migrate to LayC (#3241)
- Loading branch information
1 parent
923f9ff
commit e65d456
Showing
10 changed files
with
71 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,26 @@ | ||
== Why is this an issue? | ||
|
||
Code annotated as deprecated should not be used since it will be removed sooner or later. | ||
|
||
=== Noncompliant code example | ||
include::../description.adoc[] | ||
|
||
[source,cpp] | ||
---- | ||
// C++14 attribute | ||
[[deprecated]] | ||
void fun(); | ||
[[deprecated("Use newFunction instead.")]] | ||
void oldFunction(); | ||
// GNU attribute | ||
__attribute__((deprecated)) | ||
void fun(); | ||
__attribute__((deprecated("Use newFunction instead."))) | ||
void oldFunction(); | ||
// Microsoft attribute | ||
__declspec(deprecated) | ||
void fun(); | ||
__declspec(deprecated("Use newFunction instead.")) | ||
void oldFunction(); | ||
void newFunction(); | ||
void example() { | ||
fun(); // Noncompliant | ||
oldFunction(); // Noncompliant | ||
} | ||
---- | ||
|
||
== Resources | ||
|
||
* https://cwe.mitre.org/data/definitions/477[MITRE, CWE-477] - Use of Obsolete Functions | ||
* https://wiki.sei.cmu.edu/confluence/x/6TdGBQ[CERT, MET02-J.] - Do not use deprecated or obsolete classes or methods | ||
|
||
ifdef::env-github,rspecator-view[] | ||
|
||
''' | ||
== Implementation Specification | ||
(visible only on this page) | ||
|
||
include::../message.adoc[] | ||
|
||
''' | ||
== Comments And Links | ||
(visible only on this page) | ||
|
||
include::../comments-and-links.adoc[] | ||
|
||
endif::env-github,rspecator-view[] | ||
include::../see.adoc[] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
Once deprecated, classes, and interfaces, and their members should be avoided, rather than used, inherited or extended. Deprecation is a warning that the class or interface has been superseded, and will eventually be removed. The deprecation period allows you to make a smooth transition away from the aging, soon-to-be-retired technology. | ||
Code is sometimes annotated as deprecated by developers maintaining libraries or APIs to indicate that the method, class, or other programming element is no longer recommended for use. This is typically due to the introduction of a newer or more effective alternative. For example, when a better solution has been identified, or when the existing code presents potential errors or security risks. | ||
|
||
Deprecation is a good practice because it helps to phase out obsolete code in a controlled manner, without breaking existing software that may still depend on it. It is a way to warn other developers not to use the deprecated element in new code, and to replace it in existing code when possible. | ||
|
||
Deprecated classes, interfaces, and their members should not be used, inherited or extended because they will eventually be removed. The deprecation period allows you to make a smooth transition away from the aging, soon-to-be-retired technology. | ||
|
||
Check the documentation or the deprecation message to understand why the code was deprecated and what the recommended alternative is. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
== Why is this an issue? | ||
|
||
Code annotated as deprecated should not be used since it will be removed sooner or later. | ||
|
||
=== Noncompliant code example | ||
include::../description.adoc[] | ||
|
||
[source,kotlin] | ||
---- | ||
@Deprecated("") | ||
interface Old | ||
class Example : Old // Noncompliant | ||
---- | ||
ifdef::env-github,rspecator-view[] | ||
@Deprecated("This function is deprecated, use newFunction instead", ReplaceWith("newFunction()")) | ||
fun oldFunction() { | ||
println("This is the old function.") | ||
} | ||
''' | ||
== Implementation Specification | ||
(visible only on this page) | ||
fun newFunction() { | ||
println("This is the new function.") | ||
} | ||
include::../message.adoc[] | ||
oldFunction() // Noncompliant: "oldFunction is deprecated" | ||
---- | ||
|
||
endif::env-github,rspecator-view[] | ||
include::../see.adoc[] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
== Resources | ||
|
||
=== Documentation | ||
* https://cwe.mitre.org/data/definitions/477[MITRE, CWE-477] - Use of Obsolete Functions |