Showing 407 of 1,235 total issues
Function RoutesPage
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const RoutesPage = () => {
const { isFetching, refetch } = useRoutes();
const [search, setSearch] = useState("");
const { data: routes } = useRoutes();
Method Workflow.validate
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func (o *Workflow) validate() error {
if len(o.States) == 0 {
return errors.New("workflow has no defined states")
}
- 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 EventEngine.multiConditionEventAndHandler
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func (ee EventEngine) multiConditionEventAndHandler(l *datastore.EventListener, waitType bool) eventHandler {
return func(ctx context.Context, events ...*datastore.Event) {
for _, event := range events {
if l.Deleted {
return // Skip processing for deleted listeners.
- 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 fsController.updateFile
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func (e *fsController) updateFile(w http.ResponseWriter, r *http.Request) {
ns := extractContextNamespace(r)
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
Method engine.getInstanceMemory
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (engine *engine) getInstanceMemory(ctx context.Context, id uuid.UUID) (*instanceMemory, error) {
tx, err := engine.flow.beginSQLTx(ctx, &sql.TxOptions{
Isolation: sql.LevelSerializable,
})
if err != nil {
Method instanceMemory.SetVariables
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (im *instanceMemory) SetVariables(ctx context.Context, vars []states.VariableSetter) error {
tx, err := im.engine.flow.beginSQLTx(ctx)
if err != nil {
return err
}
Method events.addInstanceEventListener
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (events *events) addInstanceEventListener(ctx context.Context, namespace uuid.UUID, nsName string, instance uuid.UUID, sevents []*model.ConsumeEventDefinition, all bool) error {
// var ev []map[string]interface{}
fEv := &datastore.EventListener{
ID: uuid.New(),
Method varController.listRaw
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (e *varController) listRaw(w http.ResponseWriter, r *http.Request) {
ns := extractContextNamespace(r)
db, err := e.db.BeginTx(r.Context())
if err != nil {
Method logController.stream
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m logController) stream(w http.ResponseWriter, r *http.Request) {
// cursor is set to multiple seconds before the current time to mitigate data loss
// that may occur due to delays between submitting and processing the request, or when a sequence of client requests is necessary.
cursor := time.Now().UTC().Add(-time.Second * 3)
Function RoutesBreadcrumb
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const RoutesBreadcrumb = () => {
const pages = usePages();
const namespace = useNamespace();
const { isGatewayRoutesPage, isGatewayRoutesDetailPage, routePath } =
pages.gateway.useParams();
Function buildEnvVars
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func buildEnvVars(forSidecar bool, c *core.Config, sv *core.ServiceFileData) []corev1.EnvVar {
proxyEnvs := []corev1.EnvVar{}
if len(c.KnativeProxyHTTP) > 0 {
proxyEnvs = append(proxyEnvs, corev1.EnvVar{
Function ServicesBreadcrumb
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ServicesBreadcrumb = () => {
const pages = usePages();
const namespace = useNamespace();
const { isServicePage, isServiceDetailPage, service } =
pages.services.useParams();
Method generateEventLogic.Run
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (logic *generateEventLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
err := scheduleOnce(logic, wakedata)
if err != nil {
return nil, err
}
Function buildContainers
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
func buildContainers(c *core.Config, sv *core.ServiceFileData) ([]corev1.Container, error) {
// set resource limits.
rl, err := buildResourceLimits(c, sv)
if err != nil {
return nil, err
Function getLayoutedElements
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getLayoutedElements = (
incomingEles: (Edge | Node)[],
orientation: Orientation = "vertical"
) => {
const dagreGraph = new dagre.graphlib.Graph();
Function recurseIntoString
has 14 return statements (exceeds 4 allowed). Open
func recurseIntoString(data interface{}, s string) ([]interface{}, error) {
out := make([]interface{}, 0)
if TrimWhitespaceOnQueryStrings {
s = strings.TrimSpace(s)
Function generateActionInput
has 14 return statements (exceeds 4 allowed). Open
func generateActionInput(ctx context.Context, args *generateActionInputArgs) ([]byte, []model.FunctionFileDefinition, error) {
var err error
var input interface{}
input, err = jqObject(args.Source, "jq(.)") //nolint:contextcheck
Consider simplifying this complex logical expression. Open
if !(v.MIMEType == "text/plain; charset=utf-8" || v.MIMEType == "text/plain" || v.MIMEType == "application/octet-stream") && (d == "{}" || d == "[]" || d == "0" || d == `""` || d == "null") {
Function EditorLayoutSwitcher
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const EditorLayoutSwitcher = () => {
const { t } = useTranslation();
const currentLayout = useEditorLayout();
const { setLayout: setCurrentLayout } = useEditorActions();
return (
Function BaseInputTemplate
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const BaseInputTemplate = (props: BaseInputTemplateProps) => {
const type = useMemo(() => {
if (props.schema.type === "integer") {
return "number";
} else if (props.type === "file") {