tycho icon indicating copy to clipboard operation
tycho copied to clipboard

Add useProjectSettings option to CleanUpMojo

Open Copilot opened this issue 2 months ago • 1 comments

Adds a useProjectSettings parameter to CleanUpMojo to read cleanup preferences from Eclipse project settings, matching the behavior already present in the compiler mojo.

Changes

CleanUpMojo.java

  • Added useProjectSettings parameter (default: true)
  • Implemented loadCleanupSettingsFromPrefsFile() to parse .settings/org.eclipse.jdt.ui.prefs and extract keys with cleanup. or sp_cleanup. prefixes
  • Implemented getEffectiveCleanUpProfile() to merge mojo configuration with project settings (project settings take precedence)
  • Returns null when no settings configured, consistent with existing CleanUp class behavior

tycho-core/.gitignore

  • Added http/ and https/ to exclude build cache artifacts

Usage

When enabled (default), cleanup settings from .settings/org.eclipse.jdt.ui.prefs override the cleanUpProfile parameter:

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-cleancode-plugin</artifactId>
  <configuration>
    <!-- Uses project settings by default -->
    <useProjectSettings>true</useProjectSettings>
    
    <!-- These values will be overridden by project settings if present -->
    <cleanUpProfile>
      <sp_cleanup.format_source_code>true</sp_cleanup.format_source_code>
    </cleanUpProfile>
  </configuration>
</plugin>

Gracefully handles missing preference files with debug logging.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • testng.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/tycho/.codeql-scratch/dbs/java/working/files-to-index15590033309118846739.list --sourceArchiveDir=/home/REDACTED/work/tycho/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/tycho/.codeql-scratch/dbs/java/trap/java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Add an option "useProjectSettings" to the CleanUpMojo

In the compiler mojo we already have a setting "use project settings" to allow tycho to use the preferences from the IDE.

We need such option here as well and if enabled a project setting found will override the mojo configured map (we need to üarse the preference file and extract all keys starting with cleanup. as we can not pass the file directly to the code)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot avatar Nov 01 '25 06:11 Copilot

I just realized there are two ways, need to first clarify what should be supported:

  • https://github.com/eclipse-jdt/eclipse.jdt.core/discussions/4582

we then also need to adjust the previous feature

  • https://github.com/eclipse-tycho/tycho/pull/5557

as it currently only updates the cleanup profile

laeubi avatar Nov 01 '25 07:11 laeubi