imaginerio/narratives

View on GitHub

Showing 31 of 86 total issues

Function prepareMiddleware has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  prepareMiddleware() {
    const middleware = express();
    middleware.use(bodyParser.json());
    middleware.post('/upload', (req, res) => {
      const { name, type } = req.body;
Severity: Minor
Found in routes/upload.js - About 1 hr to fix

    Function templates has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    const templates = (template, { host, key }, lang) => {
      switch (template) {
        case 'reset-password':
          return lang === 'pt'
            ? `<p>Clique <a href="${host}/user/reset/${key}">aqui</a> para redefinir sua senha.</p>`
    Severity: Minor
    Found in server/email.js - About 55 mins to fix

    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 Signup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    const Signup = () => {
      const {
        createAccount,
        enterDetails,
        name,
    Severity: Minor
    Found in src/pages/signup.js - About 55 mins to fix

    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 View has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const View = ({ data }) => {
      const [viewport, setViewport] = useState({});
      const [year, setYear] = useState(data.Project.slides[0].year);
      const [activeBasemap, setActiveBasemap] = useState(null);
      const [opacity, setOpacity] = useState(1);
    Severity: Minor
    Found in src/components/View/index.jsx - About 45 mins to fix

    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 AtlasContext has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const AtlasContext = ({ slide }) => {
      const { loading, error, data } = useQuery(GET_SLIDE_ATLAS, {
        variables: { slide },
      });
    
    
    Severity: Minor
    Found in src/components/Atlas/Context.jsx - About 45 mins to fix

    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 Reset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const Reset = ({ verified }) => {
      const {
        query: { key },
      } = useRouter();
    
    
    Severity: Minor
    Found in src/pages/user/reset/[key].js - About 35 mins to fix

    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 Image has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const Image = ({ image, updateHandler }) => {
      const fileInputRef = useRef(null);
      const { chooseFile, caption, imageCaption } = useLocale();
    
      const [isLoading, setIsLoading] = useState(false);
    Severity: Minor
    Found in src/components/Image/index.jsx - About 35 mins to fix

    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 too many return statements within this function.
    Open

          return {
            ...state,
            slide: payload,
          };
    Severity: Major
    Found in src/providers/DrawProvider/index.js - About 30 mins to fix

      Function Login has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const Login = () => {
        const { locale } = useRouter();
        const { welcome, loginFull, email, password, loginError, verifyError, login, forgot } =
          useLocale();
      
      
      Severity: Minor
      Found in src/pages/login.js - About 25 mins to fix

      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 Home has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export const Home = ({ user, data, content }) => {
        const { locale } = useRouter();
        const { gallery, signUp, manage, login } = useLocale();
      
        return (
      Severity: Minor
      Found in src/pages/index.js - About 25 mins to fix

      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 populateBasemaps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const populateBasemaps = async (keystone, context) => {
        // Populate basemaps
        const {
          data: { allBasemaps },
        } = await keystone.executeGraphQL({
      Severity: Minor
      Found in initial-data.js - About 25 mins to fix

      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

      Severity
      Category
      Status
      Source
      Language