Skip to content

Conversation

@Marat-Tim
Copy link
Contributor

In this pull request, I’m updating the library’s main API - now there’s a single entry point: the Program class
Previously, Program only searched for errors in a package, but that logic is now handled by the new EoPackage class (copied entirely from the old Program)

@github-actions github-actions bot added the core Changes are made to core parts of the code base label May 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2025

🚀 Performance Analysis

All 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
Test Base Score PR Score Change % Change Unit Mode

@Marat-Tim Marat-Tim marked this pull request as draft May 8, 2025 14:44
@Marat-Tim
Copy link
Contributor Author

@h1alexbel WDYT about this architecture?

Copy link
Member

@h1alexbel h1alexbel left a 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(
Copy link
Member

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),
Copy link
Member

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
Copy link
Member

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 {
Copy link
Member

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;
*
Copy link
Member

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());
Copy link
Member

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>
Copy link
Member

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 @@
/*
Copy link
Member

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();
Copy link
Member

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 {
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes are made to core parts of the code base

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants