I have even tried "Compliant Solution" given :
/*
* SonarQube, open source software quality management tool.
* Copyright (C) 2008-2013 SonarSource
* mailto:contact AT sonarsource DOT com
*
* SonarQube is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* SonarQube is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
but it's not fixing the code smell. Can you please give me the working SIMPLEST EXAMPLE which can solve this?
Code Smell. A maintainability-related issue in the code. Leaving it as-is means that at best maintainers will have a harder time than they should making changes to the code. At worst, they'll be so confused by the state of the code that they'll introduce additional errors as they make changes.
This rule will have been configured with the expected header when it was added to the profile being applied to your project. You should check not the "Compliant Solution" but that configuration to see what's expected.
Note that the header can be configured as a regex. Typically this is used to deal with copyright year variations, but you should double check whether it's being used as a regex as well.
Check your project settings for the header format configured for the Rule: Track lack of copyright and license headers (java:S1451)
If this is empty/blank, then insert a blank at the beginning of every file, which will resolve this issue.
If you are using SonarLint as a plugin you can find this setting under Window --> Preferences --> SonarLint --> Java --> Track lack of copyright and license headers
PS: If you don't wanna do this and not a cup of your tea, simply disable this rule.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With