The Wayback Machine - https://web.archive.org/web/20230131055539/https://github.com/brndnmtthws/conky/commit/e91b91d85a459bf37367b73b6d295373e404b0b2
Skip to content
Permalink
Browse files
Apply a bunch of code fixes from sonarcloud. (#492)
  • Loading branch information
brndnmtthws committed May 13, 2018
1 parent 42e4343 commit e91b91d85a459bf37367b73b6d295373e404b0b2
Show file tree
Hide file tree
Showing 19 changed files with 968 additions and 556 deletions.
@@ -0,0 +1,117 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Delimiter: pb
Language: TextProto
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
...

@@ -4,4 +4,4 @@ root = true
end_of_line = lf
insert_final_newline = true
indent_style = space
intend_size = 2
indent_size = 2
@@ -7,7 +7,6 @@ matrix:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
packages:
- g++-8
- cmake
@@ -24,7 +23,6 @@ matrix:
- libimlib2-dev
- libxinerama-dev
- gawk
- clang-6.0
sonarcloud:
organization: "brndnmtthws-github"
token:
@@ -65,8 +63,6 @@ before_script:
- mkdir build && cd build
- cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
- cd ..
- cp build/compile_commands.json .
- ./bin/check-style.sh
- mkdir build-no-x11
- cd build-no-x11
- cmake -DBUILD_X11=OFF ..
@@ -77,7 +73,7 @@ script:
- cd ../build-no-x11
- make -j4
- cd ..
- if [ "$CC" = "gcc-8" ] ; then sonar-scanner ; fi
- if [ "$CXX" = "clang++-6.0" ] ; then sonar-scanner ; fi
branches:
only:
- master
@@ -2,3 +2,4 @@ sonar.projectKey=conky
sonar.projectName=Conky
sonar.sources=src
sonar.cfamily.build-wrapper-output=build/bw-output
sonar.cpp.std=c++17
@@ -230,6 +230,7 @@ int update_apcupsd() {
freeaddrinfo(ai);
if (rp == nullptr) {
// no error reporting, the daemon is probably not running
close(sock);
break;
}

@@ -241,20 +242,20 @@ int update_apcupsd() {
if (send(sock, &sz, sizeof(sz), 0) != sizeof(sz) ||
send(sock, "status", 6, 0) != 6) {
perror("send");
close(sock);
break;
}

//
// read the lines of output and put them into the info structure
//
if (fill_items(sock, &apc) == 0) {
close(sock);
break;
}

} while (0);

close(sock);

//
// "atomically" copy the data into working set
//

0 comments on commit e91b91d

Please sign in to comment.