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;
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>`
- 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 Signup
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const Signup = () => {
const {
createAccount,
enterDetails,
name,
- 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 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);
- 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 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 },
});
- 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 Reset
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const Reset = ({ verified }) => {
const {
query: { key },
} = useRouter();
- 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 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);
- 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 too many return
statements within this function. Open
return {
...state,
slide: payload,
};
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();
- 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 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 (
- 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 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({
- 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"