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

Update SwiftLint plugin to use environment property on Process #207

Conversation

JosephDuffy
Copy link
Member

This was failing when the system shell is fish (because fish requires env to be prepended). Using the environment property on Process makes this shell-agnostic

This was failing when the system shell is fish. Using the `environment` property on `Process` makes this shell-agnostic
import Logger
@testable import RunnerLib
import XCTest
Copy link
Member Author

Choose a reason for hiding this comment

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

These changes seem to have been done during the pre-commit hook

@@ -42,6 +42,13 @@ extension DangerfilePathFinderTests {
]
}

extension GetDangerJSPathTests {
Copy link
Member Author

Choose a reason for hiding this comment

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

These changes seem to have been done during the pre-commit hook

@JosephDuffy
Copy link
Member Author

This was working locally but isn't in CI. Will fix!

Copy link
Member

@f-meloni f-meloni left a comment

Choose a reason for hiding this comment

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

Looks good can you please update the changelog?

Copy link
Member

@f-meloni f-meloni left a comment

Choose a reason for hiding this comment

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

Looks there are some problems with CI on linux

@JosephDuffy
Copy link
Member Author

Looks good can you please update the changelog?

Thanks! I've updated the changelog with the change

@JosephDuffy
Copy link
Member Author

Looks there are some problems with CI on linux

I can't immediately see what's going wrong here, I'll look in to it further

Maybe these were causing the linux builds to fail on CI? The reason isn’t obvious to me
This was done during the pre-commit hook but didn’t seem to be committed
@orta
Copy link
Member

orta commented Mar 8, 2019

This is very weird:

danger:runDangerSubprocess Passed DSL in via STDIN +0ms
The program 'swift' is currently not installed. To run 'swift' please ask your administrator to install the package 'python-swiftclient'
Ran with: /tmp/_tmp_dangerfile.swift /tmp/danger-dsl.json /tmp/danger-response.json
Decoding the DSL into Swift types
Setting up to dump results
Executing `swift run swiftlint lint --quiet --reporter json --use-script-input-files --force-exclude` with environment variables ["SCRIPT_INPUT_FILE_1": "Sources/Danger/Plugins/SwiftLint/ShellExecutor.swift", "SCRIPT_INPUT_FILE_2": "Sources/Danger/Plugins/SwiftLint/SwiftLint.swift", "SCRIPT_INPUT_FILE_COUNT": "3", "SCRIPT_INPUT_FILE_0": "Sources/Danger-Swift/Fake.swift"]
Sending results back to Danger

@f-meloni
Copy link
Member

f-meloni commented Mar 8, 2019

Could it be related to the env override? Maybe it has to be merged with the current process env?
(The env of a process is inherited from the current process)
Will make a try to see if it fixes it

@f-meloni
Copy link
Member

f-meloni commented Mar 8, 2019

Ok fixed! 🎉
Can you please use the same logic on spawn, and remove the test logs? And we are ready to merge :)

@JosephDuffy
Copy link
Member Author

Could it be related to the env override? Maybe it has to be merged with the current process env?
(The env of a process is inherited from the current process)
Will make a try to see if it fixes it

Ah I hadn't thought of this, good catch!

I should have a chance to clean this up tonight/tomorrow.

Thanks for the fix 😄

This file is in a cycle of changes, I think thanks to SwiftLint
It seems to want to end with a new line, but also not start with whitespace. This comment both explains the file and fixes the SwiftLint issue
@DangerCI
Copy link

DangerCI commented Mar 8, 2019

Warnings
⚠️

Sources/Danger/Plugins/SwiftLint/ShellExecutor.swift#L3 - TODOs should be resolved (Get a logger into here this is...). (todo)

Generated by 🚫 Danger Swift against ebb5189

arguments.joined(separator: " ")].filter { !$0.isEmpty }.joined(separator: " ")
print("Executing \(script)")
print("Executing `\(script)` with environment variables \(environmentVariables)")
Copy link
Member Author

Choose a reason for hiding this comment

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

@f-meloni this was here before, but I have updated it to include the environment variables now.

Should I remove this or keep it?

If I keep I'll update it to print the merged envs and also add it to the spawn function below?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I like it :)

`print` statement was also removed. This may we re-added in response to https://github.com/danger/swift/pull/207/files#r263776454
@@ -0,0 +1 @@
// An empty file to allow the DangerDependencies target to build via SPM
Copy link
Member

Choose a reason for hiding this comment

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

Thanks :)

@f-meloni
Copy link
Member

f-meloni commented Mar 8, 2019

merge on green

@peril-staging peril-staging bot merged commit db863cd into danger:master Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants