Showing 407 of 1,235 total issues
Function Filters
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const Filters = ({ filters, onUpdate }: FiltersProps) => {
const { t } = useTranslation();
// activeMenu controls which popover component is opened (there are
// separate popovers triggered by the respective buttons)
- 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 InstancesBreadcrumb
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const InstancesBreadcrumb = () => {
const pages = usePages();
const namespace = useNamespace();
const { isInstancePage, isInstanceDetailPage, instance } =
pages.instances.useParams();
Method JSOutboundPlugin.Execute
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (js *JSOutboundPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
var (
err error
b []byte
)
Method nsController.create
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (e *nsController) create(w http.ResponseWriter, r *http.Request) {
// Parse request.
req := struct {
Name string `json:"name"`
Function useParams
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
useParams: () => {
const { "*": path, namespace } = useParams();
const [, , thirdLvl, fourthLvl] = useMatches(); // first level is namespace level
const [searchParams] = useSearchParams();
Function MirrorBreadcrumb
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const MirrorBreadcrumb = () => {
const pages = usePages();
const namespace = useNamespace();
const { isMirrorPage, isSyncDetailPage, sync } = pages.mirror.useParams();
const { icon: Icon } = pages.mirror;
Function ExplorerHeader
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ExplorerHeader: FC = () => {
const pages = usePages();
const namespace = useNamespace();
const { path } = pages.explorer.useParams();
Function InputOutput
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const InputOutput = () => {
const instanceId = useInstanceId();
const { data } = useInstanceDetails({ instanceId });
const tabs = ["input", "output"] as const;
Method parallelLogic.processActionResults
has 18 return statements (exceeds 4 allowed). Open
func (logic *parallelLogic) processActionResults(ctx context.Context, children []*ChildInfo, results *actionResultPayload) (*Transition, error) {
var err error
var found bool
var idx int
Method fsController.createFile
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (e *fsController) createFile(w http.ResponseWriter, r *http.Request) {
ns := extractContextNamespace(r)
db, err := e.db.BeginTx(r.Context())
if err != nil {
Function JqState
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
func JqState(l *lexer.L) lexer.StateFunc {
src := make([]string, 3)
var jdxJ int
mover := func(rewind int, forward bool) {
Function useApiCommandTemplate
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useApiCommandTemplate = (namespace: string, workflow: string) => {
const baseUrl = window.location.origin;
const memoizedTemplates: TemplateType[] = useMemo(
() => [
{
Method engine.doKnativeHTTPRequest
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
func (engine *engine) doKnativeHTTPRequest(ctx context.Context,
ar *functionRequest, arReq *enginerefactor.ActionRequest,
) {
ctx, spanEnd, err := tracing.NewSpan(ctx, "executing knative request to action")
if err != nil {
- 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 nsController.update
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
func (e *nsController) update(w http.ResponseWriter, r *http.Request) {
name := chi.URLParam(r, "name")
db, err := e.db.BeginTx(r.Context())
if err != nil {
- 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 appendEventListenersToDB
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func appendEventListenersToDB(ctx context.Context, nsID uuid.UUID, nsName string, file *filestore.File, lifespan time.Duration, ms *muxStart, tx *database.SQLStore) error {
fEv := &datastore.EventListener{
ID: uuid.New(),
CreatedAt: time.Now().UTC(),
UpdatedAt: time.Now().UTC(),
Function ScrollContainer
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ScrollContainer = () => {
const instanceId = useInstanceId();
const { data: instanceDetailsData } = useInstanceDetails({ instanceId });
const isStreaming = instanceDetailsData?.status === "pending";
const {
Method engine.EventsInvoke
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (engine *engine) EventsInvoke(tctx context.Context, workflowID uuid.UUID, events ...*cloudevents.Event) {
ctx := context.Background()
tx, err := engine.flow.beginSQLTx(ctx)
if err != nil {
Function PermissionsHint
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const PermissionsHint = () => {
const { data: availablePermissions } = usePermissionKeys();
const permissionsAvailable = (availablePermissions ?? []).length > 0;
const { t } = useTranslation();
return (
Method instController.handleWait
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (e *instController) handleWait(ctx context.Context, w http.ResponseWriter, r *http.Request, data *instancestore.InstanceData) {
var err error
id := data.ID
dt := time.Millisecond * 100
Function LoadResource
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
func LoadResource(data []byte) (interface{}, error) {
m := make(map[string]interface{})
err := yaml.Unmarshal(data, &m)
if err != nil {
return nil, fmt.Errorf("%w: %w", ErrNotDirektivAPIResource, err)