Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The maven pom.xml contains a lot more than what would be in cargo.toml.

How much extra config or shell scripts would cargo have to have to add code coverage, findbug tools (that do things like linting and pattern matching to detect common coding errors)? How much extra is needed to add a unit testing mechanism, an integration testing mechanism, a dependency checker (e.g., checking if you're not using a duplicate transitive that is pulling in different versions that might clash)?

The only thing comparable to cargo.toml is these 40-ish lines[1], which you pay double for the xml tax. The rest are things that are adding value, but could be removed (tho i would say it's adding a lot more value than it's costing you lines of code).

[1]https://github.com/binkley/modern-java-practices/blob/master...



> How much extra config or shell scripts would cargo have to have to add code coverage

2 lines with cargo tarpaulin. 1 to add the dependency, 1 to actually run it.

> findbug tools (that do things like linting and pattern matching to detect common coding errors)?

0. It's built in. Cargo check runs by default, you can run cargo clippy with 1 line if you want stricter checks.

> How much extra is needed to add a unit testing mechanism, an integration testing mechanism,

0. It's built in. (I don't particularly like the built in integration test mechanism, but that's another matter)

> a dependency checker (e.g., checking if you're not using a duplicate transitive that is pulling in different versions that might clash)

0. Cargo does this already.


You could put all this stuff in a parent POM and re-use it for all your projects.

Statements like "just 2 lines" in Cargo is just a weird comparison. Because it's only 2 lines if you don't configure anything. You can also use all this stuff out of the box with Maven or Gradle with far fewer lines if you don't configure anything. I can point out a whole slew of weird defaults in Clippy [1] which will probably require me to specify a dozen of the hundreds [2] of configuration options it has.

> 0. It's built in. Cargo check runs by default, you can run cargo clippy with 1 line if you want stricter checks.

Findbugs is a framework for static code analysis with plugin support and what not. Clippy is just a linter.

[1] https://rust-lang.github.io/rust-clippy/master/index.html [2] https://doc.rust-lang.org/clippy/lint_configuration.html


The world has moved on though to opinionated tools, and Rust isn't even the furthest in that direction (That would be Go). The equivalent of those two lines in Cargo.toml would be this example of a basic configuration from the jacoco-maven-plugin: https://www.jacoco.org/jacoco/trunk/doc/examples/build/pom.x... - That's 40 lines in the <plugin> section to do the "defaults".

Yes, you could add a load of config for files to include/exclude from coverage and so on, but the idea that that's a norm is way more common in Java projects than other languages. Like here's some example Cargo.toml files from complicated Rust projects:

Servo: https://github.com/servo/servo/blob/main/Cargo.toml

rust-gdext: https://github.com/godot-rust/gdext/blob/master/godot-core/C...

ripgrep: https://github.com/BurntSushi/ripgrep/blob/master/Cargo.toml

socketio: https://github.com/1c3t3a/rust-socketio/blob/main/socketio/C...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: