Can I configure the used ruleset for SonarLint - sonarlint

Can I disable / enable the set of rules that are shown by SonarLint for VS? How?
A similar question was already asked in Is there some graphical way to create my own configuration file on SonarLint? but I wasn't able to follow the answer, i.e. did not find the Project/References/Analyzers node in the Solution Explorer, to be able to edit the active rule set file. Can you help me out on this one?

Here is how to open the active rule set of a project:
From there, you'll be able to enable and disable rules:
The path to the rule set file to be used is saved within your .csproj file under the <CodeAnalysisRuleSet>...</CodeAnalysisRuleSet> tag. You can reference the same rule set file from multiple projects, and store the rule set along with your project sources in Git / TFVC if you'd like all developers to share the same rule set.

Related

VS Code - How to stop it deleting whitespaces?

I am using Microsoft's VS Code to edit css, html and ts files that are shared by my team on a VSTS Git repo. However, my VS Code keeps removing empty/whitespaces that my colleagues added when I save any change (Image below) and this screws up the whole Git Diff part, as almost every single line of code shows as a diff.
I tried to disable every single config setup but nothings works:
At the end, what was causing my problem was the extension: EditorConfig for VS Code
This plugin attempts to override user/workspace settings with settings
found in .editorconfig files. No additional or vscode-specific files
are required. As with any EditorConfig plugin, if root=true is not
specified, EditorConfig will continue to look for an .editorconfig
file outside of the project.
I believe, it was overriding the options I selected inside of VS Code (such as files.trimTrailingWhitespace: false). So, no setup change I was making was actually being applied.
It seems you have trailing whitespace enabled in User Preferences too.
I'd suggest opening your configuration file of VSCode using
CtrlShiftP or
CmdShiftP in Mac and then go to Open User Settings.
I'm sure the next line is around there somewhere, delete it or change it to false.
files.trimTrailingWhitespace": true
In my case, the JS-CSS-HTML Formatter extension from lonefy
caused the problem.
Editor › Comments: Ignore Empty Lines
——>choose :false

Per-solution Atomineer preferences

With Atomineer Pro Doc for VS, is it possible to have the (some?) settings/preferences saved in the current $(SolutionDir) directory? I realize that there is an option to save/use the prefs.xml file from locations other than the default by setting the Search Paths under General Settings / Preference Storage, but those look to be requiring absolute paths, while my question is specifically about being able to define such paths relative to the current solution/project file.
Yes, it's easy to do this - you just need to use the variable %projectPath% or %solutionPath% in your search paths to make them relative to the current project or solution.
This allows you to use different settings for every project/solution you work in, and also to check the settings into source control so they can be shared across your team easily.

PhpStorm groups SCSS/CSS files ignoring my configuration

I am running PhpStorm 2016.3.2 (I believe it is the current latest).
Since I've updated to this version, css files are always grouped / nested under their scss source files in the project tree, regardless if I have a SCSS watcher or not.
I've tried creating a completely empty new project, with no file watchers whatsoever, and manually created two files: test.scss and test.css. Immediately, the test.css got grouped under the test.scss.
Furthermore (in another project), I am using a custom transpiler, which creates a x.html file for each x.scss file in addition to the x.css file. However, no matter what I set in the Output paths to refresh field, PhpStorm will always group the CSS file, and only the CSS file under the SCSS node.
I am trying to make it also group the HTML file under that node, but ideally I want to know why is it doing any grouping at all when there are no file watchers?
I do want to point out that this was NOT an issue in the previous version.
Is there some hidden setting I am missing, is it a bug or is it a mandatory new "feature"?
Is there some hidden setting I am missing,
No.
is it a bug or is it a mandatory new "feature"?
It's a new feature -- file nesting no longer relies on presence of File Watcher (and the need to run it to have files actually nested).
At the moment it's implemented as hard-coded list of rules which you cannot modify (but you may try and suggest other rules and why they will be good).
UPDATE: The list of nesting rules is fully customizable since 2017.2 version. You can access those rules via cog icon in Project View panel where you may add your own or even disable such nesting.

PHPStorm exclude vendor from search but keep Intellisense

Any idea how can I exclude the vendor directory from Search in files and folders but keep it in indexing for Intellisense purposes?
I need to search only in my Symfony files, not the framework and so on.
Tried Scopes in Settings, with this pattern:
!file[abuse]:vendor//*
Thank you!
I tried using scopes but it didn't seem to work for me. The vendor files still turned up when trying to open files (ctrl + shift + n) and in order to use the scope I had to manually select it from the find in all files dialog.
I better solution I found was using the composer settings in PhpStom as shown in this question.
Just add your composer.json and composer.phar into the composer settings and it does the rest for you!
Scopes functionality is the way to go here.
You just need to ensure that you have inclusive parts as well and not exclude rules only. The solution is to include everything recursively and only then exclude unwanted stuff.
The reason for that -- ATM search does not correctly process scopes that have exclude rules only.

Vagrant: Automating edit of config files - standard approach?

For example I want to automate the adding of a SAMBA share by adding a share "block" /etc/samba/smb.conf (if it is not already present), as in: https://stackoverflow.com/a/16624958/227926
...rather than have to manually edit this file.
I'd want it to detect if the block was already present too.
thoughts?
Using Shell provisioner in the Vagrantfile may be the easiest way.
See: http://docs.vagrantup.com/v2/provisioning/shell.html
Use either inline (here document) or an external shell script in Vagrantfile, to check if the block exists (e.g. use grep/ack/ag etc and check the return value $?), if NOT, add it to the /etc/samba/smb.conf.
Hope it helps.