Showing 407 of 1,235 total issues
Method engine.Transition
has 82 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (engine *engine) Transition(ctx context.Context, im *instanceMemory, nextState string, attempt int) *states.Transition {
ctx, cleanup, err := tracing.NewSpan(ctx, "engine transitions: "+nextState)
if err != nil {
slog.Debug("transition failed to init telemetry", "error", err)
}
Function EndpointPage
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
const EndpointPage: FC = () => {
const pages = usePages();
const { path } = pages.explorer.useParams();
const namespace = useNamespace();
const { segments } = analyzePath(path);
Function JqState
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
func JqState(l *lexer.L) lexer.StateFunc {
src := make([]string, 3)
var jdxJ int
mover := func(rewind int, forward bool) {
- 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 events.handleEvent
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (events *events) handleEvent(ctx context.Context, ns *datastore.Namespace, ce *cloudevents.Event) error {
ctx = tracing.WithTrack(tracing.AddNamespace(ctx, ns.Name), tracing.BuildNamespaceTrack(ns.Name))
ctx, end, err := tracing.NewSpan(ctx, "handling event-messages")
if err != nil {
slog.Debug("GetListenersByTopic failed to init telemetry", "error", err)
Method getterLogic.Run
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (logic *getterLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
err := scheduleOnce(logic, wakedata)
if err != nil {
return nil, err
}
Method instController.getPagination
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (e *instController) getPagination(r *http.Request) (*paginationOptions, error) {
opts := new(paginationOptions)
x := r.URL.Query().Get("limit")
if x != "" {
Function ConsumerTable
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ConsumerTable = () => {
const { t } = useTranslation();
const {
data: consumerList,
isSuccess,
Function ServicesListPage
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ServicesListPage = () => {
const { t } = useTranslation();
const {
data: serviceList,
isFetching,
Function generateActionInput
has 80 lines of code (exceeds 50 allowed). Consider refactoring. 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
Method LocalServer.varHandler
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (srv *LocalServer) varHandler(w http.ResponseWriter, r *http.Request) {
actionId := r.URL.Query().Get("aid")
srv.requestsLock.Lock()
req, ok := srv.requests[actionId]
Function NamespaceSelector
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
const NamespaceSelector = () => {
const pages = usePages();
const { t } = useTranslation();
const namespace = useNamespace();
Function NoMirror
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
const NoMirror = () => {
const { t } = useTranslation();
const docsUrl = "https://docs.direktiv.io/environment/git/";
const examplesUrl = "https://github.com/direktiv/direktiv-examples";
Function ServicePage
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ServicePage: FC = () => {
const pages = usePages();
const { path } = pages.explorer.useParams();
const namespace = useNamespace();
const { segments } = analyzePath(path);
File index.tsx
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
BookOpen,
FileInput,
FileOutput,
Play,
Function Logs
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Logs = () => {
const { t } = useTranslation();
const {
data: logLines = [],
Function ListenersList
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ListenersList = () => {
const [offset, setOffset] = useState(0);
const { data, isFetched, isAllowed, noPermissionMessage } = useEventListeners(
{ limit: pageSize, offset }
);
Function generateActionInput
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. 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
- 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 getValidNumber
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function getValidNumber(
value: string,
{ max, min = 0, loop = false }: GetValidNumberConfig
) {
let numericValue = parseInt(value, 10);
- 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 InitPubSub
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
func InitPubSub(notifier Notifier, database string) (*Pubsub, error) {
reportProblem := func(ev pq.ListenerEventType, err error) {
if err != nil {
slog.Error("PubSub listener encountered an error.", "error", err, "event_type", ev)
Function NewMain
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewMain(circuit *core.Circuit, args *NewMainArgs) error {
// Create service manager
var err error
var serviceManager core.ServiceManager
if !args.Config.DisableServices {