Git Product home page Git Product logo

asleekgeek / sonar-dotnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sonarsource/sonar-dotnet

1.0 0.0 0.0 134.08 MB

Code analyzer for C# and VB.NET projects https://redirect.sonarsource.com/plugins/vbnet.html

Home Page: https://redirect.sonarsource.com/plugins/csharp.html

License: GNU Lesser General Public License v3.0

Shell 0.01% JavaScript 0.22% Python 0.01% Java 2.05% Smalltalk 0.01% C# 82.20% F# 0.24% PowerShell 0.13% XSLT 0.04% CSS 0.10% Makefile 0.01% PureBasic 0.02% HTML 4.93% Liquid 0.04% Batchfile 0.01% Visual Basic .NET 10.00% ASP.NET 0.01%

sonar-dotnet's Introduction

Code Quality and Security for C# and VB.NET

Build Status

Product Quality Gate Coverage
Analyzer Quality Gate Coverage
Plugin Quality Gate Coverage

Static analysis of C# and VB.NET languages in SonarQube, SonarCloud and SonarLint code quality and security products. These Roslyn analyzers allow you to produce Clean Code that is safe, reliable, and maintainable by helping you find and correct bugs, vulnerabilities, and code smells in your codebase.

Features

Useful public resources

Nuget.org packages

Integration with SonarQube and SonarCloud

Do you have a question or feedback?

Get started

How to contribute

There are many ways you can contribute to the sonar-dotnet project. When contributing, please respect our Code of Conduct.

Join the discussions

One of the easiest ways to contribute is to share your feedback with us (see give feedback) and also answer questions from our community forum. You can also monitor the activity on this repository (opened issues, opened PRs) to get more acquainted with what we do.

Pull Request (PR)

If you want to fix an issue, please read the Get started pages first and make sure that you follow our coding style.

Before submitting the PR, make sure all tests are passing (all checks must be green).

  • We suggest you do not pick issues with the Area: CFG label (they are difficult, can have many side effects and are less likely to be accepted).
  • We suggest you do not implement new rules unless they are already specified for C# and/or VB.NET on our rules repository.

Note: Our CI does not get automatically triggered on the PRs from external contributors. A member of our team will review the code and trigger the CI on demand by adding a comment on the PR (see Azure Pipelines Comment triggers docs):

  • /azp run Sonar.Net - It will run the full pipeline, including plugin tests and promotion

Join us

If you would like to work on this project full-time, we are hiring!

Custom Rules

To request new rules, Contact us on our Community Forum.

If you have an idea for a rule but you are not sure that everyone needs it, you can implement your own Roslyn analyzer.

Configuring Rules

SonarQube / SonarCloud and SonarLint in Connected Mode

Open the rule in SonarQube / SonarCloud, scroll down, and (in case the rule has parameters), you can configure the parameters for each Quality Profile the rule is part of.

Use SonarLint Connected Mode to connect to SonarQube and SonarCloud.

SonarLint

The easiest way is to configure a Quality Profile in SonarCloud.

  • Create a dummy repository and analyze it in SonarCloud (it's free for open-source).
  • Configure the Quality Profile in SonarCloud for the project you created.
  • Then connect SonarLint to that project, and it will download the configuration (ruleset and SonarLint.xml files) locally and update your project based on the Quality Profile.

Standalone NuGet

The rules from standalone NuGet packages can be enabled or disabled in the same way as the other analyzers based on Roslyn, by using the .globalconfig or .editorconfig files. See: https://learn.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2022#set-rule-severity-in-an-editorconfig-file

If the rules are parameterized, the parameter values can be changed using SonarLint.xml additional files.

The first step is to create a new file, named SonarLint.xml, that has the following structure:

<?xml version="1.0" encoding="utf-8"?>
<AnalysisInput xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Settings>
    <Setting>
      <Key>sonar.cs.analyzeGeneratedCode</Key>
      <Value>false</Value>
    </Setting>
  </Settings>
  <Rules>
    <Rule>
      <Key>S107</Key>
      <Parameters>
        <Parameter>
          <Key>max</Key>
          <Value>2</Value>
        </Parameter>
      </Parameters>
    </Rule>
  </Rules>
</AnalysisInput>

Then, update the projects to include this additional file:

<ItemGroup>
  <AdditionalFiles Include="SonarLint.xml" />
</ItemGroup>

Internal resources

Build configuration

License

Copyright 2014-2024 SonarSource.

Licensed under the GNU Lesser General Public License, Version 3.0

sonar-dotnet's People

Contributors

pavel-mikula-sonarsource avatar costin-zaharia-sonarsource avatar alexvictoor avatar dbolkensteyn avatar bellingard avatar andrei-epure-sonarsource avatar martin-strecker-sonarsource avatar csaba-sagi-sonarsource avatar dependabot[bot] avatar mary-georgiou-sonarsource avatar tim-pohlmann avatar valhristov avatar cristian-ambrosini-sonarsource avatar dinesh-bolkensteyn-sonarsource avatar zsolt-kolbay-sonarsource avatar dmitry-golovinov-sonarsource avatar gregory-paidis-sonarsource avatar michalb-sonar avatar sebastien-marichal avatar tamasvajk avatar antonioaversa avatar duncanp-sonar avatar christophe-zurn-sonarsource avatar tomverin avatar ehartmann avatar dbmeneses avatar godin avatar loic-joly-sonarsource avatar henryju avatar lindamartin avatar

Stargazers

Roman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.