Showing 425 of 1,264 total issues
Function Authdialog
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const Authdialog = () => {
const { t } = useTranslation();
const [showKey, setShowKey] = useState(false);
const { setApiKey: storeApiKey } = useApiActions();
const apiKeyFromLocalStorage = useApiKey();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method SubflowFunctionDefinition.Validate
has 5 return statements (exceeds 4 allowed). Open
func (o *SubflowFunctionDefinition) Validate() error {
if o == nil {
return nil
}
Method ActionDefinition.Validate
has 5 return statements (exceeds 4 allowed). Open
func (o *ActionDefinition) Validate() error {
if o == nil {
return nil
}
Method ValidateState.Validate
has 5 return statements (exceeds 4 allowed). Open
func (o *ValidateState) Validate() error {
if err := o.commonValidate(); err != nil {
return err
}
Method varController.getRaw
has 5 return statements (exceeds 4 allowed). Open
func (e *varController) getRaw(w http.ResponseWriter, r *http.Request) {
id, err := uuid.Parse(chi.URLParam(r, "variableID"))
if err != nil {
w.WriteHeader(http.StatusBadRequest)
return
Method fsController.readRaw
has 5 return statements (exceeds 4 allowed). Open
func (e *fsController) readRaw(w http.ResponseWriter, r *http.Request) {
ns := extractContextNamespace(r)
db, err := e.db.BeginTx(r.Context())
if err != nil {
Method seeWorker.start
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
func (lw *seeWorker) start(ctx context.Context) {
go func() {
ticker := time.NewTicker(lw.Interval)
defer ticker.Stop()
defer close(lw.Ch)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function jq
has 5 return statements (exceeds 4 allowed). Open
func jq(input interface{}, command string) ([]interface{}, error) {
data, err := json.Marshal(input)
if err != nil {
return nil, err
}
Method sqlEventListenerStore.Append
has 5 return statements (exceeds 4 allowed). Open
func (s *sqlEventListenerStore) Append(ctx context.Context, listener *datastore.EventListener) error {
q := `INSERT INTO event_listeners
(id, namespace_id, namespace, created_at, updated_at, deleted, received_events, trigger_type, events_lifespan, event_types, trigger_info, metadata, event_context_filters)
VALUES ( $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 , $11, $12, $13);`
Function ParseStateType
has 5 return statements (exceeds 4 allowed). Open
func ParseStateType(s string) (StateType, error) {
if s == "" {
return 0, fmt.Errorf("type must be one of %v", stateTypeStrings)
}
Method varController.get
has 5 return statements (exceeds 4 allowed). Open
func (e *varController) get(w http.ResponseWriter, r *http.Request) {
// handle raw var read.
if r.URL.Query().Get("raw") == "true" {
e.getRaw(w, r)
return
Method secretsController.update
has 5 return statements (exceeds 4 allowed). Open
func (e *secretsController) update(w http.ResponseWriter, r *http.Request) {
ns := extractContextNamespace(r)
secretName := chi.URLParam(r, "secretName")
db, err := e.db.BeginTx(r.Context())
Function FileViewer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const FileViewer = ({ file }: { file: BaseFileSchemaType }) => {
const { t } = useTranslation();
const theme = useTheme();
const { data } = useFile({ path: file.path });
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function ExplorerPage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const ExplorerPage: FC = () => {
const pages = usePages();
const namespace = useNamespace();
const { path } = pages.explorer.useParams();
const { data, isSuccess, isFetched, isAllowed, noPermissionMessage } =
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function ServicePage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const ServicePage: FC = () => {
const pages = usePages();
const { path } = pages.explorer.useParams();
const namespace = useNamespace();
const { segments } = analyzePath(path);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return [...startSegment, ...activeSegment, ...endSegment];
Avoid too many return
statements within this function. Open
if (!servicesList) return null;
Avoid too many return
statements within this function. Open
return (
<Card className="m-5 flex grow">
<NoPermissions>{noPermissionMessage}</NoPermissions>
</Card>
);
Avoid too many return
statements within this function. Open
return (
<Card className="m-5 flex grow">
<NoPermissions>{noPermissionMessage}</NoPermissions>
</Card>
);
Avoid too many return
statements within this function. Open
return (
<Card className="m-5 flex grow">
<NoPermissions>{noPermissionMessage}</NoPermissions>
</Card>
);