File tree Expand file tree Collapse file tree 4 files changed +27
-0
lines changed
delphi-checks-testkit/src/main/java/au/com/integradev/delphi/checks/verifier
delphi-frontend/src/main/java
au/com/integradev/delphi/check
org/sonar/plugins/communitydelphi/api/check Expand file tree Collapse file tree 4 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## [ Unreleased]
99
10+ ### Added
11+
12+ - ** API:** ` DelphiCheckContext::getUri ` method.
13+
1014### Fixed
1115
1216- Parsing errors on semicolon-delimited generic type parameters in routine implementation headers.
Original file line number Diff line number Diff line change 2222import au .com .integradev .delphi .file .DelphiFile .DelphiInputFile ;
2323import au .com .integradev .delphi .preprocessor .CompilerSwitchRegistry ;
2424import au .com .integradev .delphi .reporting .DelphiIssueBuilderImpl ;
25+ import java .net .URI ;
2526import java .util .ArrayList ;
2627import java .util .Collection ;
2728import java .util .List ;
@@ -58,6 +59,11 @@ public DelphiCheckContextTester(
5859 this .checkRegistrar = checkRegistrar ;
5960 }
6061
62+ @ Override
63+ public URI getUri () {
64+ return delphiFile .getInputFile ().uri ();
65+ }
66+
6167 @ Override
6268 public DelphiAst getAst () {
6369 return delphiFile .getAst ();
Original file line number Diff line number Diff line change 2121import au .com .integradev .delphi .file .DelphiFile .DelphiInputFile ;
2222import au .com .integradev .delphi .preprocessor .CompilerSwitchRegistry ;
2323import au .com .integradev .delphi .reporting .DelphiIssueBuilderImpl ;
24+ import java .net .URI ;
2425import java .util .List ;
2526import org .sonar .api .batch .sensor .SensorContext ;
2627import org .sonar .plugins .communitydelphi .api .ast .DelphiAst ;
@@ -51,6 +52,11 @@ public DelphiCheckContextImpl(
5152 this .checkRegistrar = checkRegistrar ;
5253 }
5354
55+ @ Override
56+ public URI getUri () {
57+ return delphiFile .getInputFile ().uri ();
58+ }
59+
5460 @ Override
5561 public DelphiAst getAst () {
5662 return delphiFile .getAst ();
Original file line number Diff line number Diff line change 1919package org .sonar .plugins .communitydelphi .api .check ;
2020
2121import au .com .integradev .delphi .preprocessor .CompilerSwitchRegistry ;
22+ import java .net .URI ;
2223import java .util .List ;
2324import java .util .Objects ;
25+ import org .sonar .api .batch .fs .InputFile ;
2426import org .sonar .plugins .communitydelphi .api .ast .DelphiAst ;
2527import org .sonar .plugins .communitydelphi .api .ast .DelphiNode ;
2628import org .sonar .plugins .communitydelphi .api .directive .CompilerDirectiveParser ;
3032
3133/** Context injected in check classes and used to report issues. */
3234public interface DelphiCheckContext {
35+ /**
36+ * Identifier of the file. The only guarantee is that it is unique in the project. You should not
37+ * assume it is a file:// URI.
38+ *
39+ * @return identifier of the file
40+ * @see InputFile#uri()
41+ */
42+ URI getUri ();
43+
3344 /**
3445 * Returns the parsed ast of the current file.
3546 *
You can’t perform that action at this time.
0 commit comments