Showing 407 of 1,235 total issues
Function buildService
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func buildService(c *core.Config, sv *core.ServiceFileData, registrySecrets []corev1.LocalObjectReference) (*servingv1.Service, error) {
containers, err := buildContainers(c, sv)
if err != nil {
return nil, err
}
Method manager.runCycle
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *manager) runCycle() []error {
if !m.servicesListHasBeenSet {
return nil
}
// clone the list
Function RoutesDetailPage
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const RoutesDetailPage = () => {
const pages = usePages();
const { routePath } = pages.gateway.useParams();
const { data, isAllowed, isFetched, noPermissionMessage } = useRoute({
routePath: routePath ?? "",
Function initLegacyServer
has 13 return statements (exceeds 4 allowed). Open
func initLegacyServer(circuit *core.Circuit, config *core.Config, db *gorm.DB, dbManager *database.SQLStore) (*server, error) {
srv := new(server)
srv.ID = uuid.New()
srv.initJQ()
srv.config = config
Method Pubsub.flush
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (pubsub *Pubsub) flush() {
slice := pubsub.buffer[:pubsub.bufferIdx]
clusterMessages := make([]string, pubsub.bufferIdx)
messageIndex := 0
pubsub.bufferIdx = 0
- 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 forEachLogic.processActionResults
has 13 return statements (exceeds 4 allowed). Open
func (logic *forEachLogic) processActionResults(ctx context.Context, children []*ChildInfo, results *actionResultPayload) (*Transition, error) {
var err error
var found bool
var idx int
Method instController.getPagination
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (e *instController) getPagination(r *http.Request) (*paginationOptions, error) {
opts := new(paginationOptions)
x := r.URL.Query().Get("limit")
if x != "" {
- 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 13 return statements (exceeds 4 allowed). 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 {
Method eventsController.registerCoudEvent
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (c *eventsController) registerCoudEvent(w http.ResponseWriter, r *http.Request) {
ns := extractContextNamespace(r)
cType := r.Header.Get("Content-type")
limit := int64(1024 * 1024 * 32)
- 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 RootQuery.CreateFile
has 13 return statements (exceeds 4 allowed). Open
func (q *RootQuery) CreateFile(ctx context.Context, path string, typ filestore.FileType, mimeType string, data []byte) (*filestore.File, error) {
path, err := filestore.SanitizePath(path)
if err != nil {
return nil, fmt.Errorf("%w: %w", filestore.ErrInvalidPathParameter, err)
}
Function LoadResource
has 13 return statements (exceeds 4 allowed). 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)
Method RequestConvertPlugin.Execute
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (rcp *RequestConvertPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
response := &RequestConvertResponse{
URLParams: make(map[string]string),
QueryParams: make(map[string][]string),
Consumer: RequestConsumer{
Method engine.handleInstanceMessage
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (engine *engine) handleInstanceMessage(ctx context.Context, im *instanceMemory, msg *instancestore.InstanceMessageData) *states.Transition {
instanceCtx := tracing.AddInstanceMemoryAttr(ctx,
tracing.InstanceAttributes{
Namespace: im.Namespace().Name,
InstanceID: im.GetInstanceID().String(),
Method actionLogic.scheduleAction
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (logic *actionLogic) scheduleAction(ctx context.Context, attempt int) error {
input, files, err := generateActionInput(ctx, &generateActionInputArgs{
Instance: logic.Instance,
Source: logic.GetInstanceData(),
Action: logic.Action,
Method varController.list
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (e *varController) list(w http.ResponseWriter, r *http.Request) {
// handle raw var read.
if r.URL.Query().Get("raw") == "true" {
e.listRaw(w, r)
return
Method engine.executor
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (engine *engine) executor(ctx context.Context, id uuid.UUID) {
var im *instanceMemory
for attempts := range 3 {
if attempts > 0 {
Function Breadcrumb
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Breadcrumb = () => {
const pages = usePages();
const namespace = useNamespace();
const { isExplorerPage } = pages.explorer.useParams();
const { isInstancePage } = pages.instances.useParams();
Function ScrollContainer
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ScrollContainer = () => {
const {
rowVirtualizer,
parentRef,
logLines,
Function Run
has 12 return statements (exceeds 4 allowed). Open
func Run(circuit *core.Circuit) error {
config := &core.Config{}
if err := env.Parse(config); err != nil {
return fmt.Errorf("parsing env variables: %w", err)
}
Method engine.newIsolateRequest
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
func (engine *engine) newIsolateRequest(im *instanceMemory, stateID string, timeout int,
fn model.FunctionDefinition, inputData []byte,
uid uuid.UUID, async bool, files []model.FunctionFileDefinition, iterator int,