Showing 80 of 224 total issues
Function useMap
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const useMap = (): Handler => {
const [{ min_scale, max_scale }] = useContext(ConfigContext);
const [coordX, coordY, coordS] = useContext(CoordContext);
const delegate = useContext(DelegateContext);
Function setupUpdateCallback
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupUpdateCallback() {
super.setupUpdateCallback();
if (this.cursor === undefined) {
return;
}
Function InitType
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func InitType() {
TypeList = []ModelType{
PLAYER,
RESIDENCE,
COMPANY,
Function usePinch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const usePinch = () => {
const model = useContext(ModelContext);
const [pressed, setPressed] = useState(false);
const [start, setStart] = useState(ZERO);
const [now, setNow] = useState(ZERO);
- 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 CacheMap
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const CacheMap = () => {
const theme = useTheme();
const classes = useStyles(theme);
const [{ min_scale, max_scale }] = useContext(ConfigContext);
const [coordX, coordY, coordS, , , update] = useContext(CoordContext);
- 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 updateAnchor
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
updateAnchor(force: boolean) {
if (!force && this.object !== undefined) {
return;
}
- 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 activate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected activate(objOnChunk: Monitorable | undefined) {
let activation = true;
switch (this.props.menu) {
case MenuStatus.EXTEND_RAIL:
if (this.anchor.object === objOnChunk) {
- 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 default
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function() {
const theme = useTheme();
const classes = useStyles(theme);
const [opened, setOpened] = React.useState(false);
const [confirmMessage, setConfirmMessage] = React.useState("");
- 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 default
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function() {
const theme = useTheme();
const classes = useStyles(theme);
const isTiny = useMediaQuery(theme.breakpoints.down("xs"));
const [, update] = useContext(LoadingContext);
Method LineTask.Resolve
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (lt *LineTask) Resolve(args ...Entity) {
for _, raw := range args {
switch obj := raw.(type) {
case *Player:
lt.O = obj
Function useModel
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const useModel = (my?: UserInfo | null) => {
const [state, dispatch] = useReducer(reducer, {
completed: false,
error: null,
model: new GameModel({
Function AsyncProvider
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AsyncProvider = <E, I, O, S>(props: AsyncProperties<E, I, O, S>) => {
const [context, initialFetch, endpoint, reloadTask, convert] = useAsyncStatus(
props.ctx,
props.initialFetch,
props.endpoint,
Function updateDisplayInfo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateDisplayInfo() {
if (
this.from !== undefined &&
this.to !== undefined &&
this.from.current !== undefined &&
Function resolve
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
resolve(error: ResolveError) {
let resourceName = this.getResourceName();
if (resourceName !== undefined) {
let parent = this.model.gamemap.get(resourceName, this.props.pid) as
| PointModel
- 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 validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const validate = (
x: number,
y: number,
s: number,
xScale: number,
- 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 deeply nested control flow statements. Open
if re, err := services.ConnectRailNode(o, from.(*entities.RailNode), to.(*entities.RailNode), sc.Scale); err != nil {
c.Set(keyErr, err)
} else {
c.Set(keyOk, &connectResponse{re, re.Reverse})
}
Avoid deeply nested control flow statements. Open
if rn != to {
var connected bool
for _, e := range rn.OutEdges {
if e.ToNode == to {
connected = true
Avoid deeply nested control flow statements. Open
if (!cursor) {
extend(server.x, server.y, anchor.get("cid"));
} else {
if (model.controllers.getCursor().get("mul") === 1) {
connect(anchor.get("cid"), cursor.get("cid"));
Method Auther.GetGoogleOAuthInfo
has 7 return statements (exceeds 4 allowed). Open
func (a *Auther) GetGoogleOAuthInfo(resState string, code string) (*OAuthInfo, error) {
if resState != a.state {
return nil, fmt.Errorf("invalid state")
}
ctx := context.Background()
Function hueToRgb
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function hueToRgb(H: number) {
let S = config.hsv.saturation;
let V = config.hsv.value;
let C = V * S;
let Hp = H / 60;
- 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"