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

ConfigurationLocation is modified on project open to not point to file #590

Open
proteus-russ opened this issue Sep 8, 2022 · 2 comments

Comments

@proteus-russ
Copy link

This may be related to #430 although this is a relatively new change in behavior.

It is adding a "../" every time the project is opened.

I have a configuration location as follows

<ConfigurationLocation id="68dfd152-966e-457b-b366-14e5ff035aa9" type="PROJECT_RELATIVE" scope="All" description="Some Coding Conventions">
  $PROJECT_DIR$/../config/checkstyle/checkstyle.xml
  <option name="properties">
    <map>
      <entry key="basedir" value="/" />
    </map>
  </option>
</ConfigurationLocation>

Once I open a project the configuration location is changed to

<ConfigurationLocation id="68dfd152-966e-457b-b366-14e5ff035aa9" type="PROJECT_RELATIVE" scope="All" description="Some Coding Conventions">
  $PROJECT_DIR$/../../config/checkstyle/checkstyle.xml
  <option name="properties">
    <map>
      <entry key="basedir" value="/" />
    </map>
  </option>
</ConfigurationLocation>

The next time

<ConfigurationLocation id="68dfd152-966e-457b-b366-14e5ff035aa9" type="PROJECT_RELATIVE" scope="All" description="Some Coding Conventions">
  $PROJECT_DIR$/../../../config/checkstyle/checkstyle.xml
  <option name="properties">
    <map>
      <entry key="basedir" value="/" />
    </map>
  </option>
</ConfigurationLocation>

and so on

<ConfigurationLocation id="68dfd152-966e-457b-b366-14e5ff035aa9" type="PROJECT_RELATIVE" scope="All" description="Some Coding Conventions">
  $PROJECT_DIR$/../../../../../../config/checkstyle/checkstyle.xml
  <option name="properties">
    <map>
      <entry key="basedir" value="/" />
    </map>
  </option>
</ConfigurationLocation>

The only way to run checkstyle is to rollback the changes made to the configuration on startup and then reload the config file.

@jshiell
Copy link
Owner

jshiell commented Sep 19, 2022

Those whom the Gods wish to destroy, they first send file handling in IDEA. I've failed to reproduce this, but given the continual problems with anything that relies on IDEA's magic PROJECT_DIR, I've no doubt at all that there's something awry. The logic around what the project directory is gets messier and messier with every IDEA release.

Could you please give me any information on your environment that might be relevant? e.g. OS, project layout (are you using an ipr file or .idea, is it a simple <project>/.idea or something multi-module/more complicated, ...?), ...?

For reference, I'm working on Mac OS 12.6, IDEA 2022.2.2, with a simple structure:

project/.idea/checkstyle-idea.xml
config/relative-test.xml

@SamBarker
Copy link

I think I'm seeing this issue on our project.

Where we have a shared .idea folder committed to version control, we use a fairly standard multi-module maven setup.
The checkstle config file is stored in ${PROJECT_ROOT_DIR}/etc/checkstyle-custom_checks.xml However we are seeing

diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml
index 8f92bbe..bbe1fbc 100644
--- a/.idea/checkstyle-idea.xml
+++ b/.idea/checkstyle-idea.xml
@@ -10,7 +10,7 @@
(bundled)
(bundled)

     $PROJECT_DIR$/../etc/checkstyle-custom_checks.xml
     $PROJECT_DIR$/../../etc/checkstyle-custom_checks.xml
     <option name="properties">
       <map>
         <entry key="checkstyle.suppressions.file" value="etc/checkstyle-suppressions.xml" />
diff --git a/.idea/misc.xml b/.idea/misc.xml

(looking at the diff we have already committed once with an extraneous .. in it.

Not entirely sure when the change is happening (I think it's on commit rather than project open)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants