Skip to content

Conversation

@thomasscheer
Copy link

To be able to configure the PNPM packagemanager via config.yml or ort.yml, it is necessary to provide the Config in Pnpm.kt

@thomasscheer thomasscheer requested a review from a team as a code owner December 8, 2025 15:31
* Ignore "pnpmfile" when analyzing projects. Defaults to ""--ignore-scripts"
*/
@OrtPluginOption(defaultValue = "true")
val ignore_scripts: Boolean,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you have a rationale, why this needs to be configurable?
In particular, in which cases would one want to set these to false?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular, in which cases would one want to set these to false?

I've seen cases where scripts generate files for other package managers in a multi-package-manager-setup.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please share one such case?

And also, are you sure this realted to --ignore-scripts, which to my understanding is for post installation, which in turn is for dependencies, not for (ORT) projects. And multi-package-manager-setup to me sounds like a project thing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please share one such case?

Unfortunately not, it has been a private repository. But this project has a similar concept where react-native integration is run from scripts.

And also, are you sure this realted to --ignore-scripts, which to my understanding is for post installation,

I'm not sure, but the docs are very generic and say "Do not execute any scripts defined in the project package.json and its dependencies" (emphasis mine), so it sounds not to be limited to post-install scripts.

And multi-package-manager-setup to me sounds like a project thing.

I'm not sure what that means. There certainly are project setups where you need to know in which order to build things to get the right results, i.e. use ORT's mustRunAfter functionality.

What's the problem with making this configurable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our case, the pnpmfile-mechanism is used to generate code during the build. The pnpm install won't work with --ignore-pnpmfile.

I added the second variable only for completness.

Copy link
Member

@fviernau fviernau Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the problem with making this configurable?

If it's needed to make it configurable, there is no problem at all.
I just wanted to understand the need. If there is no need I believe then it shouldn't be done.
But for ignore-scripts I found further evidence that configuration makes sense, see https://www.npmjs.com/package/can-i-ignore-scripts.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the need for ignore_pnpmfile? Does this have to be configurable, or could it always be ignored?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we generally should make things configurable if they deviate from the package manager's default. PNPM's default is to not ignore scripts, and if we'd hard-code to do ignore script, that might be different from what users expect.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we generally should make things configurable if they deviate from the package manager's default.

I believe we used to follow the rule to make things configurable only if needed, and not if it deviates from default.
It would be relatively easy to come up with a list of counter examples, invalidating this rule. For exmaple, we do set the node-linker and this should not be configurable.

/**
* The version of PNPM to use when analyzing projects. Defaults to the version 10.24.0
*/
val pnpmVersion: String?,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be unused.

* Ignore "pnpmfile" when analyzing projects. Defaults to "--ignore-pnpmfile"
*/
@OrtPluginOption(defaultValue = "true")
val ignore_pnpmfile: Boolean,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please stick to camel-case option names.

Comment on lines +54 to +58
/**
* Ignore "pnpmfile" when analyzing projects. Defaults to "--ignore-pnpmfile"
*/
@OrtPluginOption(defaultValue = "true")
val ignore_pnpmfile: Boolean,

Check warning

Code scanning / detekt

Constructor parameter names should follow the naming convention set in the projects configuration. Warning

Constructor parameter names should match the pattern: [a-z][A-Za-z0-9]*
Comment on lines +60 to +64
/**
* Ignore "pnpmfile" when analyzing projects. Defaults to ""--ignore-scripts"
*/
@OrtPluginOption(defaultValue = "true")
val ignore_scripts: Boolean,

Check warning

Code scanning / detekt

Constructor parameter names should follow the naming convention set in the projects configuration. Warning

Constructor parameter names should match the pattern: [a-z][A-Za-z0-9]*
* Ignore "pnpmfile" when analyzing projects. Defaults to ""--ignore-scripts"
*/
@OrtPluginOption(defaultValue = "true")
val ignore_scripts: Boolean,

Check warning

Code scanning / detekt

Rule to mandate/forbid trailing commas at declaration sites Warning

Unnecessary trailing comma before ")"
@OrtPluginOption(defaultValue = "true")
val ignore_scripts: Boolean,


Check warning

Code scanning / detekt

Reports consecutive blank lines Warning

Needless blank line(s)
@OrtPluginOption(defaultValue = "true")
val ignore_scripts: Boolean,


Check warning

Code scanning / detekt

Detects trailing spaces Warning

Trailing space(s)
factory = PackageManagerFactory::class
)
class Pnpm(override val descriptor: PluginDescriptor = PnpmFactory.descriptor) :
class Pnpm(override val descriptor: PluginDescriptor = PnpmFactory.descriptor, private val config: PnPMConfig) :

Check warning

Code scanning / detekt

Detects trailing spaces Warning

Trailing space(s)
class Pnpm(override val descriptor: PluginDescriptor = PnpmFactory.descriptor) :
class Pnpm(override val descriptor: PluginDescriptor = PnpmFactory.descriptor, private val config: PnPMConfig) :
NodePackageManager(NodePackageManagerType.PNPM) {

Check warning

Code scanning / detekt

Detects trailing spaces Warning

Trailing space(s)
}

private fun installDependencies(workingDir: File, scopes: Collection<Scope>) {

Check warning

Code scanning / detekt

Reports methods that have an empty first line. Warning

First line in a method block should not be empty
}

private fun installDependencies(workingDir: File, scopes: Collection<Scope>) {

Check warning

Code scanning / detekt

Detects trailing spaces Warning

Trailing space(s)
* Ignore "pnpmfile" when analyzing projects. Defaults to "--ignore-pnpmfile"
*/
@OrtPluginOption(defaultValue = "true")
val ignore_pnpmfile: Boolean,

Check notice

Code scanning / QDJVMC

Property naming convention Note

Property name ignore_pnpmfile should not contain underscores
* Ignore "pnpmfile" when analyzing projects. Defaults to ""--ignore-scripts"
*/
@OrtPluginOption(defaultValue = "true")
val ignore_scripts: Boolean,

Check notice

Code scanning / QDJVMC

Property naming convention Note

Property name ignore_scripts should not contain underscores
@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.48%. Comparing base (86da192) to head (ac51bc0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...package-managers/node/src/main/kotlin/pnpm/Pnpm.kt 77.77% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #11200   +/-   ##
=========================================
  Coverage     57.47%   57.48%           
  Complexity     1704     1704           
=========================================
  Files           346      346           
  Lines         12855    12861    +6     
  Branches       1222     1224    +2     
=========================================
+ Hits           7389     7393    +4     
  Misses         4992     4992           
- Partials        474      476    +2     
Flag Coverage Δ
funTest-external-tools 13.75% <77.77%> (+0.04%) ⬆️
funTest-no-external-tools 30.99% <0.00%> (-0.03%) ⬇️
test-ubuntu-24.04 42.47% <55.55%> (+0.01%) ⬆️
test-windows-2025 42.45% <55.55%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

val pnpmVersion: String?,

/**
* Ignore "pnpmfile" when analyzing projects. Defaults to "--ignore-pnpmfile"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the KDoc mention the default value, it should imho use the Boolean type.

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

Successfully merging this pull request may close these issues.

3 participants