-
Notifications
You must be signed in to change notification settings - Fork 17
feat(#123): Program also use Source for linting #575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
🚀 Performance AnalysisAll benchmarks are within the acceptable range. No critical degradation detected (threshold is 100%). Please refer to the detailed report for more information. Click to see the detailed report
|
|
@h1alexbel WDYT about this architecture? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marat-Tim see my comments, please. In general architecture is OK, the only thing concerns me is that, in Program, we depend on multiple concrete classes: Source, EoPackage. I think we can introduce more reliable dependencies via interfaces. @yegor256 WDYT?
| "passes with no exceptions", | ||
| new Source(new XMLDocument("<object/>")).defects(), | ||
| new Program( | ||
| Map.of( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marat-Tim let's use new MapOf<>() from org.cactoos for better consistency in the codebase
| /** | ||
| * A collection of lints for Whole Program Analysis (WPA), | ||
| * provided by the {@link Program} class. | ||
| * A collection of lints for Whole Package Analysis (WPA), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marat-Tim here, we should stay with "Whole Program Analysis"
|
|
||
| /** | ||
| * Whole EO package, as collection of XMIR sources to analyze. | ||
| * @since 0.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marat-Tim let's place correct version of the future release
| ) | ||
| ); | ||
|
|
||
| public class Program { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marat-Tim maybe we can stay with public final?
| * <pre> | ||
| * {@code | ||
| * import com.jcabi.manifests.Manifests; | ||
| * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marat-Tim this empty line is required to separate import statement and the code
| map.putAll(Program.discover(dir)); | ||
| private static <T, E extends Exception> Collection<Source> sources(final Collection<T> elements, | ||
| final CheckedFunc<T, Source, E> ctor) throws E { | ||
| final ArrayList<Source> sources = new ArrayList<>(elements.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marat-Tim can we use just java.util.Collection<Source> here, since we need only .add() and for-each?
| /** | ||
| * A single source XMIR to analyze. | ||
| * | ||
| * @see <a href="https://news.eolang.org/2022-11-25-xmir-guide.html">XMIR</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marat-Tim I would still leave this link, it can be useful for internal development
| @@ -1,11 +0,0 @@ | |||
| /* | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marat-Tim what is the point of moving benchmarks to org/eolang/lints? If we make Program the only entry point to the library - we should benchmark only that class, not Source. @yegor256 WDYT?
| @Benchmark | ||
| public final void scansLargeProgram() throws IOException { | ||
| new Program(this.home).defects(); | ||
| new EoPackage(this.home).defects(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marat-Tim here, instead of EoPackage, we should benchmark Program
| ) | ||
| ); | ||
|
|
||
| public class Program { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marat-Tim any unit tests for this class? Otherwise, we don't know what we can break making these changes
In this pull request, I’m updating the library’s main API - now there’s a single entry point: the
ProgramclassPreviously,
Programonly searched for errors in a package, but that logic is now handled by the newEoPackageclass (copied entirely from the oldProgram)