PoshCode / ModuleBuilder

A PowerShell Module to help scripters write, version, sign, package, and publish.
MIT License
445 stars 54 forks source link

Git ignore local-user-specific VSCode settings #78

Closed bravo-kernel closed 4 years ago

bravo-kernel commented 4 years ago
scrthq commented 4 years ago

The settings in that settings file are there to enforce code style across the project though, not some random personal user settings.

bravo-kernel commented 4 years ago

@scrthq the single file that I am excluding here (settings.json) is exclusively meant for personal settings, tied to the local users machine. For example, my window colors preferences are there. Code consistency is enforced through .editorconfig and .gitattributes.

gaelcolas commented 4 years ago

Editor config does not let you set the PSScript Analyzed custom rules, right?

bravo-kernel commented 4 years ago

~The point is that the settings enforced in settings.json are enforced to all my local files, not just this repository since these settings are not repository-bound.~

This is not my own idea either btw, most large repos follow this solution, all to smoothen the contribution process, something I hope we can accomplish here as well, see the template PR.

Hope this clarifies things.

ps: I totally agree that better Powershell enforcement is needed in general BTW. Especially when comparing with the tooling that is out there for js, php and all others (take prettier for example). Powershell feels a little left behind in this field.

ChrisLGardner commented 4 years ago

There's 2 settings.json files, one at the user level in ~/.vscode and the other in the root of the repo. The ones in the repo enforce settings just within that repo, the ones in the user level are for every repo (and overridden by more specific ones).

bravo-kernel commented 4 years ago

@ChrisLGardner it looks like you are correct, strikethrough applied above. The other points are still valid IMO. Here's my settings.json giving me the git status headache.

{
    "files.trimTrailingWhitespace": true,
    "files.insertFinalNewline": true,
    "editor.tabSize": 4,
    "editor.insertSpaces": true,
    "files.encoding": "utf8",
    "powershell.codeFormatting.preset": "OTBS",
    "powershell.codeFormatting.ignoreOneLineBlock": false,
    "powershell.codeFormatting.newLineAfterCloseBrace": false,
    "files.associations": {
        "*.ps1xml": "xml"
    },
    "workbench.colorCustomizations": {
        "activityBar.background": "#0A342F",
        "titleBar.activeBackground": "#0F4841",
        "titleBar.activeForeground": "#F3FDFC"
    }
}

ps: good to see so much feedback, means eyes are on this place

ChrisLGardner commented 4 years ago

If you want to change the local repo copy of the settings.json but don't want to commit it then you can use git update-index --assume-unchange .vscode/settings.json and it'll ignore all changes to that file for you.

bravo-kernel commented 4 years ago

Yes, of course that will also do the job and by reading the feedback I now think it might actually the best solution for this repo, you folks seems adequate enough to handle this as you see fit. Thus closing this PR.

I was thinking from the end-user perspective but those will most likely only be focussed on/using the files produced by the template which can have their own settings.

ps: if I could get feedback on #77 that would be highly appreciated. I am releasing a module that references ModuleBuilder soon and think it would be awesome if the template would be available then.