Skip to content
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

Add Location of a Problem if @line Attribute is Absent #343

Open
volodya-lombrozo opened this issue Feb 17, 2025 · 8 comments
Open

Add Location of a Problem if @line Attribute is Absent #343

volodya-lombrozo opened this issue Feb 17, 2025 · 8 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@volodya-lombrozo
Copy link
Member

We have found, that if @line attribute isn't set, we can't fide the place where the issue occurred, for example:

[[j$Application application-duality CRITICAL]:0 The anonymous object has duality in the application, which is prohibited,

Instead of 0 we have to put something meaningful.

There are several suggestions how to solve this issue:

#320 (comment)

#320 (comment)

@volodya-lombrozo
Copy link
Member Author

@yegor256 What do you think?

@yegor256
Copy link
Member

@volodya-lombrozo I'm not sure it's solvable, but we can try

@yegor256 yegor256 added bug Something isn't working help wanted Extra attention is needed labels Feb 17, 2025
@h1alexbel
Copy link
Contributor

@yegor256 I'm in

@yegor256
Copy link
Member

@h1alexbel sure, please, help!

@h1alexbel
Copy link
Contributor

h1alexbel commented Feb 18, 2025

@yegor256 @volodya-lombrozo how about we introduce new <context/> node inside the <defect/>? For instance, if there are no lines, application-duality will produce such a defect:

<defect line="0" severity="critical">The anonymous object has duality in the application, which is prohibited
  <context>
    <o base="man">
      <o as="name" base="string"/>
      <o base="number"/>
    </o>
  </context>
</defect>

In each XSL, where it is possible, we are able to copy the problematic XML like this <xsl:copy-of select="."/>.

The users of EO don't need this <context/> to be printed, since EO-to-Java compiler places lines, while other users, who generate XMIR by themselves (like JEO) may find it useful using lints library:

final Defect defect = ...;
final XML context = defect.context();

WDYT?

@volodya-lombrozo
Copy link
Member Author

@h1alexbel I like this idea. It might slightly help in my particular case. (Of course, getting an exact line would be perfect) However, there is one potential issue I’m concerned about: the context size. If it's small enough, then it's fine. But if it is large, it might create some performance issues. What do you think?

@h1alexbel
Copy link
Contributor

@volodya-lombrozo yes, <context/> can be bigger than reasonable size, but depends on specific lint scope. To resolve potential performance issues, we can try to convert <context/> to string, and then print only first N chars of the context. WDYT?

@h1alexbel
Copy link
Contributor

@volodya-lombrozo About lines I agree, but on the other hand, it can add some processing overhead, since we need to annotate original XMIR with lines, resolve them, and then pass annotated XMIR to lints. @yegor256 Should we try to go for it?

h1alexbel added a commit to h1alexbel/lints that referenced this issue Feb 18, 2025
h1alexbel added a commit to h1alexbel/lints that referenced this issue Feb 18, 2025
h1alexbel added a commit to h1alexbel/lints that referenced this issue Feb 18, 2025
h1alexbel added a commit to h1alexbel/lints that referenced this issue Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants