Skip to content

Conversation

wolfs
Copy link
Member

@wolfs wolfs commented Jul 16, 2021

I find this much more readable:

  • The parameters are further left, so you need less line length
  • The body is nicely separated from the list of arguments

Before:

public DefaultAfterPreviousExecutionState(OriginMetadata originMetadata,
                                          ImplementationSnapshot implementation,
                                          ImmutableList<ImplementationSnapshot> additionalImplementations,
                                          ImmutableSortedMap<String, ValueSnapshot> inputProperties,
                                          ImmutableSortedMap<String, FileCollectionFingerprint> inputFileProperties,
                                          ImmutableSortedMap<String, FileSystemSnapshot> outputFilesProducedByWork,
                                          boolean successful) {
    super(implementation, additionalImplementations, inputProperties, inputFileProperties);

After:

public DefaultAfterPreviousExecutionState(
    OriginMetadata originMetadata,
    ImplementationSnapshot implementation,
    ImmutableList<ImplementationSnapshot> additionalImplementations,
    ImmutableSortedMap<String, ValueSnapshot> inputProperties,
    ImmutableSortedMap<String, FileCollectionFingerprint> inputFileProperties,
    ImmutableSortedMap<String, FileSystemSnapshot> outputFilesProducedByWork,
    boolean successful
) {
    super(implementation, additionalImplementations, inputProperties, inputFileProperties);

Before:
```
public DefaultAfterPreviousExecutionState(OriginMetadata originMetadata,
                                          ImplementationSnapshot implementation,
                                          ImmutableList<ImplementationSnapshot> additionalImplementations,
                                          ImmutableSortedMap<String, ValueSnapshot> inputProperties,
                                          ImmutableSortedMap<String, FileCollectionFingerprint> inputFileProperties,
                                          ImmutableSortedMap<String, FileSystemSnapshot> outputFilesProducedByWork,
                                          boolean successful) {
    super(implementation, additionalImplementations, inputProperties, inputFileProperties);
```

After:

```
public DefaultAfterPreviousExecutionState(
    OriginMetadata originMetadata,
    ImplementationSnapshot implementation,
    ImmutableList<ImplementationSnapshot> additionalImplementations,
    ImmutableSortedMap<String, ValueSnapshot> inputProperties,
    ImmutableSortedMap<String, FileCollectionFingerprint> inputFileProperties,
    ImmutableSortedMap<String, FileSystemSnapshot> outputFilesProducedByWork,
    boolean successful
) {
    super(implementation, additionalImplementations, inputProperties, inputFileProperties);
```
@wolfs wolfs self-assigned this Jul 16, 2021
@bamboo
Copy link
Member

bamboo commented Jul 16, 2021

The 2nd style also makes rename and change signature refactorings produce smaller and more meaningful diffs.

Copy link
Member

@bamboo bamboo left a comment

Choose a reason for hiding this comment

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

❤️

@wolfs
Copy link
Member Author

wolfs commented Jul 19, 2021

@bot-gradle test and merge

@bot-gradle
Copy link
Collaborator

OK, I've already triggered a build for you.

@bot-gradle bot-gradle merged commit b4c5aa5 into master Jul 19, 2021
@wolfs wolfs deleted the wolfs/code-style-multiline-parameters branch July 19, 2021 07:11
@lptr
Copy link
Member

lptr commented Jul 20, 2021

Thank you, Stefan, I wanted to do this ages ago!

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.

4 participants