GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [core] Language lifecycle by oowekyala · Pull Request #4060 · pmd/pmd

Conversation

@oowekyala

@oowekyala oowekyala commented Jul 22, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Describe the PR

(This contains #4049)

  • Implement [core] Language lifecycle #3782 (the ticket is a pretty faithful description of the code changes)
  • Implement [core] Language properties #2518 (but not [core] Language properties CLI surface syntax #2947, there is still no CLI option, you can only set language properties through env variables)
  • There is a need for a new lifecycle method on Rule, to initialize the rule before it's run. Rule is now the weak point of the pmd architecture and also deserves a split into separate interfaces. I'll describe this later.

I'm opening this a bit early because I think it's a crucial step forward for the PMD 7 branch and I want to give it visibility. I will spend some more time adding tests and documentation, and improving the PR description.

This introduces the following binary incompatibilities:

  • LanguageVersion::getLanguageVersionHandler is removed
  • BaseLanguageModule is removed

Related issues

  • Fixes [core] Language lifecycle #3782
  • Fixes [core] Language properties #2518
  • TODO I implemented [core] Use empty name for languages with a single language version #4048 but in the meantime it was superseded by [core] Explicitly name all language versions #4120

Ready?

  • Added unit tests for fixed bug/feature
    • Missing unit tests for new language
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)
    • doc: Finish language_properties.md
    • doc: Update adding_a_new_javacc_based_language.md and adding_a_new_antlr_based_language.md
    • doc: Update release notes

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
oowekyala added 19 commits July 20, 2022 16:48
@oowekyala
Minimal language lifecycle
517fef6
@oowekyala
Wire in existing langs
10ff8f6
@oowekyala
try to adapt tests
2952df3
we need to remove usages of LanguageVersion::getLanguageVersionHandler
@oowekyala
make lprocessor available on nodes
7c9244d
@oowekyala
remove usages of lv::getLvh
0732739
@oowekyala
wip
ec081ed
@oowekyala
convert most lang mods to new base class
3cecfaf
@oowekyala
try out enum ids
1d1e1e9
@oowekyala
fix some tests
3d5c2d1
@oowekyala
finish superseding old base module class
94c4acb
@oowekyala
remove enum based base class
ea52a77
@oowekyala
cleanup cpdCompat
5f0ece0
@oowekyala
init rules properly
8076da0
@oowekyala
fix more modules
5c2260b
@oowekyala
fix pmd-vf
2cb54ff
needs a dependency mechanism
to prevent apex from being pruned
@oowekyala
fix more bugs
c17513b
@oowekyala
more cleanups
ffd040e
@oowekyala
Merge branch 'pmd7-lang-registry-non-static' into pmd7-language-lifec…
c562f54
…ycle
@oowekyala
Cleanups and doc
59b417b
@oowekyala oowekyala added this to the 7.0.0 milestone Jul 22, 2022
oowekyala added 5 commits July 22, 2022 17:39
@oowekyala
Merge branch 'pmd7-lang-registry-non-static' into pmd7-language-lifec…
2ec6b6c
…ycle
@oowekyala
make language of parser task more important than the lang property
019169d
@oowekyala
style: fix warnings
0781a26
@oowekyala
Add doc page
12bf4cf
@oowekyala
Fix global state in apex module
1704059
@oowekyala oowekyala mentioned this pull request Jul 23, 2022
[java] Improve rule tests with auxclasspath #2649
Open
oowekyala added 4 commits July 27, 2022 14:51
@oowekyala
Merge branch '7.0.x' into pmd7-language-lifecycle
815cc29
@oowekyala
fix tests
acc4979
@oowekyala
fix duplicated log message
df90c48
@oowekyala
Merge branch '7.0.x' into pmd7-language-lifecycle
1187a9a
oowekyala added 3 commits January 27, 2023 14:15
@oowekyala
Fix java module
29c2944
@oowekyala
Add back named versions
55eabe2
@oowekyala
Merge branch '7.0.x' into pmd7-language-lifecycle
a7cf226
@oowekyala
oowekyala marked this pull request as ready for review February 1, 2023 23:15
oowekyala and others added 3 commits February 2, 2023 01:04
@oowekyala
Merge branch '7.0.x' into pmd7-language-lifecycle
ef365cd
@adangel
Fix PMD issues (JUnit5TestShouldBePackagePrivate)
6973a68
@adangel
Fix unit tests
94c8c4b
adangel
adangel reviewed Feb 2, 2023
View reviewed changes

@adangel adangel left a comment

Copy link
Copy Markdown
Member

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.

Thanks for the amazing work! 🎉

I've updated the task list on the PR description and added some doc tasks - I'll work on them and update this PR.
Could you have a look at the task "Missing unit tests for new language" whether this is done or still needed? I'm not sure what you mean by that.

Other than that, I don't think my other comments need to be addressed immediately (especially extracting LanguageHandler into own classes, which could create another bunch of changes, that are better done separately).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread docs/pages/pmd/languages/language_properties.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/pages/pmd/languages/language_properties.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/pages/pmd/languages/language_properties.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-core/src/main/java/net/sourceforge/pmd/PmdAnalysis.java

// TODO replace those with actual language properties when the
// CLI syntax is implemented.
props.setProperty(LanguagePropertyBundle.SUPPRESS_MARKER, config.getSuppressMarker());

@adangel adangel Feb 2, 2023

Copy link
Copy Markdown
Member

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.

Maybe that's worth to document: with the cli option for suppress marker, you configure it for all languages. With the env var for the property, you configure it for a specific language.

If both a present, one should take precedence. I think, the more specific one should override the general one - that means, if both CLI option for suppressmarker is given and the env for the language property, the env should be used.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@adangel adangel Feb 2, 2023

Copy link
Copy Markdown
Member

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.

Ok, it seems the implementation is the other way around as I expected. Then it's all the more important to have the behavior documented to avoid surprises.

--suppress-marker overrides any configuration, that is provided by env vars.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageModuleBase.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageModuleBase.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexLanguageProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/multifile/ApexMultifileAnalysis.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexLanguageProcessor.java
*/

package net.sourceforge.pmd.lang.apex.internal;
package net.sourceforge.pmd.lang.apex;

@adangel adangel Feb 2, 2023

Copy link
Copy Markdown
Member

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.

Maybe ApexLanguageProcessor should stay internal - at least, JavaLanguageProcessor is internal as well...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@oowekyala oowekyala Feb 4, 2023

Copy link
Copy Markdown
Member Author

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.

Actually the language processors should probably be published at some point. I would like rules to be able to use them to initialize themselves exactly once, for instance, parse their property values into JClassTypes using the TypeSystem.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfLanguageModule.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@adangel adangel added the an:enhancement An improvement on existing features / rules label Feb 2, 2023
adangel added 4 commits February 2, 2023 17:00
@adangel
[doc] Finish language_properties.md
eac1116
@adangel
[doc] Add language configuration to sidebar
988d70c
@adangel
[doc] Update adding_a_new_{javacc|antlr}_based_language.md
058b4dd
@adangel
[doc] Update release notes (pmd#4060, pmd#2518, pmd#3782)
a864087
adangel
adangel reviewed Feb 2, 2023
View reviewed changes
Comment thread docs/pages/7_0_0_release_notes.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

oowekyala
oowekyala commented Feb 3, 2023
View reviewed changes

@oowekyala oowekyala left a comment

Copy link
Copy Markdown
Member Author

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.

Thanks for the review Andreas!

the task "Missing unit tests for new language" is about adding unit tests for the new language base classes. I'll finish this on the weekend

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

adangel reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageRegistry.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AstInfo.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/pages/pmd/languages/language_properties.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

oowekyala added 9 commits February 4, 2023 19:53
@oowekyala
Fix some details
7a31f67
@oowekyala
Merge remote-tracking branch 'origin/pmd7-language-lifecycle' into pm…
374150b
…d7-language-lifecycle
@oowekyala
Use cleaner casing convention for lang properties
b0b2b35
@oowekyala
Improve debug messages
18e424e
@oowekyala
Doc
074a0ff
@oowekyala
Make ApexProcessor not implement LVH
872a41b
@oowekyala
Details
db40a76
@oowekyala
Test LanguageModuleBase
283e516
@oowekyala
Fix bug
1de1177
@adangel adangel mentioned this pull request Feb 10, 2023
[core] Explicitly name all language versions #4387
Merged
5 of 9 tasks
adangel
adangel approved these changes Feb 10, 2023
View reviewed changes

@adangel adangel left a comment

Copy link
Copy Markdown
Member

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.

Thanks! I'll merge this next 🎉

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@adangel
adangel merged commit eee8b95 into pmd:pmd/7.0.x Feb 10, 2023
This was referenced Feb 10, 2023
[core] Language lifecycle #3782
Closed
[core] Language properties #2518
Closed
@oowekyala
oowekyala deleted the pmd7-language-lifecycle branch May 13, 2024 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adangel adangel adangel approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

an:enhancement An improvement on existing features / rules

Projects

None yet

Milestone

7.0.0

Development

Successfully merging this pull request may close these issues.

[core] Language properties

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@oowekyala @adangel
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.