Skip to content

Commit

Permalink
Merge pull request #2 from FRRouting/master
Browse files Browse the repository at this point in the history
pull request
  • Loading branch information
guoguojia2021 authored Jul 14, 2023
2 parents d40631e + 88236d4 commit d81eda7
Show file tree
Hide file tree
Showing 1,540 changed files with 121,604 additions and 20,507 deletions.
271 changes: 200 additions & 71 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,78 +1,207 @@
# SPDX-License-Identifier: GPL-2.0
# clang-format configuration file. Intended for clang-format >= 11.
#
# For more information, see:
#
# Documentation/process/clang-format.rst
# https://clang.llvm.org/docs/ClangFormat.html
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
---
BasedOnStyle: LLVM
Language: Cpp
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Linux
AlwaysBreakBeforeMultilineStrings: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
IndentCaseLabels: false
AlignEscapedNewlinesLeft: false
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
# FRR: Right
AlignEscapedNewlines: Right
AlignOperands: Align
# FRR: true
AlignTrailingComments: true
# FRR: true
AlignConsecutiveMacros: true
AllowAllParametersOfDeclarationOnNextLine: false
AlignAfterOpenBracket: true
SpaceAfterCStyleCast: false
MaxEmptyLinesToKeep: 2
BreakBeforeBinaryOperators: None
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: false
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
SortIncludes: false
IncludeCategories:
- Regex: '^(<|lib)'
Priority: 0
ColumnLimit: 80
# Linux: CommentPragmas: '^ IWYU pragma:'
CommentPragmas: '\$(FRR|clippy)'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
# Some taken from:
# git grep -h '^#define [^[:space:]]*frr_(each|with)[^[:space:]]*(' ./ \
# | sed "s,^#define \([^[:space:]]*frr_(each|with)[^[:space:]]*\)(.*$, - '\1'," \
# | LC_ALL=C sort -u
# and
# git grep -h '^#define [^[:space:]]*FOREACH[^[:space:]]*(' ./
# | sed "s,^#define \([^[:space:]]*FOREACH[^)]*\)(.*, - '\1',"
# | LC_ALL=C sort -u
ForEachMacros:
# lib
- frr_each
- frr_each_safe
- frr_each_from
- frr_rev_each
- frr_rev_each_safe
- frr_rev_each_from
- frr_with_mutex
- frr_with_privs
- LIST_FOREACH
- LIST_FOREACH_SAFE
- SLIST_FOREACH
- SLIST_FOREACH_SAFE
- SLIST_FOREACH_PREVPTR
- STAILQ_FOREACH
- STAILQ_FOREACH_SAFE
- TAILQ_FOREACH
- TAILQ_FOREACH_SAFE
- TAILQ_FOREACH_REVERSE
- TAILQ_FOREACH_REVERSE_SAFE
- RB_FOREACH
- RB_FOREACH_SAFE
- RB_FOREACH_REVERSE
- RB_FOREACH_REVERSE_SAFE
- SPLAY_FOREACH
- FOR_ALL_INTERFACES
- FOR_ALL_INTERFACES_ADDRESSES
- JSON_FOREACH
# libyang
- LY_FOR_KEYS
- LY_LIST_FOR
- LY_TREE_FOR
- LY_TREE_DFS_BEGIN
- LYD_TREE_DFS_BEGIN
# zebra
- RE_DEST_FOREACH_ROUTE
- RE_DEST_FOREACH_ROUTE_SAFE
- RNODE_FOREACH_RE
- RNODE_FOREACH_RE_SAFE
# bgpd
- UPDGRP_FOREACH_SUBGRP
- UPDGRP_FOREACH_SUBGRP_SAFE
- SUBGRP_FOREACH_PEER
- SUBGRP_FOREACH_PEER_SAFE
- SUBGRP_FOREACH_ADJ
- SUBGRP_FOREACH_ADJ_SAFE
- AF_FOREACH
- FOREACH_AFI_SAFI
- FOREACH_AFI_SAFI_NSF
- FOREACH_SAFI
# ospfd
- LSDB_LOOP
# lib: outliers:
- 'FOR_ALL_INTERFACES'
- 'FOR_ALL_INTERFACES_ADDRESSES'
# libyang outliers:
- 'LY_FOR_KEYS'
- 'LY_LIST_FOR'
- 'LY_TREE_FOR'
- 'LY_TREE_DFS_BEGIN'
- 'LYD_TREE_DFS_BEGIN'
# ospfd outliers:
- 'LSDB_LOOP'
# first git grep
- 'darr_foreach_p'
- 'darr_foreach_i'
- 'frr_each'
- 'frr_each_safe'
- 'frr_each_from'
- 'frr_rev_each'
- 'frr_rev_each_safe'
- 'frr_rev_each_from'
- 'frr_with_mutex'
- 'frr_with_privs'
# second git grep
- 'AF_FOREACH'
- 'FOREACH_ADAPTER_IN_LIST'
- 'FOREACH_AFI_SAFI'
- 'FOREACH_AFI_SAFI_NSF'
- 'FOREACH_BE_APPLY_BATCH_IN_LIST'
- 'FOREACH_BE_TXN_BATCH_IN_LIST'
- 'FOREACH_BE_TXN_IN_LIST'
- 'FOREACH_CMT_REC'
- 'FOREACH_MGMTD_BE_CLIENT_ID'
- 'FOREACH_MGMTD_DS_ID'
- 'FOREACH_SAFI'
- 'FOREACH_SESSION_IN_LIST'
- 'FOREACH_TXN_CFG_BATCH_IN_LIST'
- 'FOREACH_TXN_IN_LIST'
- 'FOREACH_TXN_REQ_IN_LIST'
- 'JSON_FOREACH'
- 'LIST_FOREACH'
- 'LIST_FOREACH_SAFE'
- 'RB_FOREACH'
- 'RB_FOREACH_REVERSE'
- 'RB_FOREACH_REVERSE_SAFE'
- 'RB_FOREACH_SAFE'
- 'RE_DEST_FOREACH_ROUTE'
- 'RE_DEST_FOREACH_ROUTE_SAFE'
- 'RNODE_FOREACH_RE'
- 'RNODE_FOREACH_RE_SAFE'
- 'SIMPLEQ_FOREACH'
- 'SIMPLEQ_FOREACH_SAFE'
- 'SLIST_FOREACH'
- 'SLIST_FOREACH_PREVPTR'
- 'SLIST_FOREACH_SAFE'
- 'SPLAY_FOREACH'
- 'STAILQ_FOREACH'
- 'STAILQ_FOREACH_SAFE'
- 'SUBGRP_FOREACH_ADJ'
- 'SUBGRP_FOREACH_ADJ_SAFE'
- 'SUBGRP_FOREACH_PEER'
- 'SUBGRP_FOREACH_PEER_SAFE'
- 'TAILQ_FOREACH'
- 'TAILQ_FOREACH_REVERSE'
- 'TAILQ_FOREACH_REVERSE_SAFE'
- 'TAILQ_FOREACH_SAFE'
- 'UPDGRP_FOREACH_SUBGRP'
- 'UPDGRP_FOREACH_SUBGRP_SAFE'
- 'XSIMPLEQ_FOREACH'
- 'XSIMPLEQ_FOREACH_SAFE'
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^(<|lib)'
Priority: 0
## New: XXX whats it mean?
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentGotoLabels: false
IndentPPDirectives: None
IndentWidth: 8
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
## Linux: MaxEmptyLinesToKeep: 1
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 8
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true

## Lowest Penalty Value wins. Values are used by clang-format to influence
## the brak decisions, it's a bit of voodoo magic though.
## Originally from linux which was "Taken from git's rules"
PenaltyBreakAssignment: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
# Don't break a string into multi-string-fragments
PenaltyBreakString: 1000
# Allow going past the ColumnLimit to keep function arguments aligned
# with the open parenthesis.
PenaltyBreakBeforeFirstCallParameter: 1000
# Try and stay under ColumnLimit, but not at the cost of incomprehensible code.
PenaltyExcessCharacter: 30
PenaltyReturnTypeOnItsOwnLine: 60

PointerAlignment: Right
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp03
TabWidth: 8
UseTab: Always
...
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
extend-ignore = E203
3 changes: 2 additions & 1 deletion .github/commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ module.exports = {
'isisd',
'ldpd',
'lib',
'mgmtd',
'multi',
'nhrpd',
'ospf6d',
'ospfd',
'pathd',
'pbrd',
'pimd',
'pim6d',
Expand All @@ -40,6 +42,5 @@ module.exports = {
],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'subject-case': [2, 'always', 'sentence-case'],
},
};
28 changes: 28 additions & 0 deletions .github/workflows/behind-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Add rebase label if the branch is > 50 commits behind

on:
pull_request_target:
types: [synchronize, opened, reopened, labeled, unlabeled]

jobs:
behind:
if: github.repository == 'frrouting/frr'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Set custom variables
id: vars
run: |
echo "behind_by=$(git log --oneline origin/${{ github.base_ref }} ^${{ github.event.pull_request.head.sha }} | wc -l)" >> $GITHUB_OUTPUT
- name: Add rebase label if needed
if: ${{ steps.vars.outputs.behind_by > 50 }}
uses: actions-ecosystem/action-add-labels@v1
with:
labels: rebase
6 changes: 4 additions & 2 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ on:
- unlabeled

jobs:
lint:
if: github.repository == 'frrouting/frr'
commitlint:
if: ${{ github.repository == 'frrouting/frr' }} && ${{ github.base_ref == 'refs/heads/master' }}
name: Check if the commits meet the requirements of the guidelines
permissions:
contents: read
pull-requests: read
Expand All @@ -26,3 +27,4 @@ jobs:
uses: wagoid/commitlint-github-action@v5
with:
configFile: .github/commitlint.config.js
helpURL: 'https://docs.frrouting.org/projects/dev-guide/en/latest/workflow.html#submitting-patches-and-enhancements'
2 changes: 1 addition & 1 deletion .github/workflows/conflicts.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Add a conflict label is PR needs to rebase
name: Add a conflict label if PR needs to rebase

on:
push:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
{arch}
build
.cache
.dir-locals.el
.msg
.rebase-*
*~
Expand All @@ -105,6 +106,7 @@ GSYMS
GRTAGS
GPATH
compile_commands.json
.ccls
.ccls-cache
.dirstamp
refix
Expand Down
2 changes: 2 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[settings]
profile = black
3 changes: 3 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
init-hook="import sys; sys.path.insert(0, '..')"
signature-mutators=common_config.retry,retry

[FORMAT]
max-line-length = 88

[MESSAGES CONTROL]
disable=I,C,R,W
Loading

0 comments on commit d81eda7

Please sign in to comment.