Showing 187 of 200 total issues
Avoid too many return
statements within this function. Open
return (
<FloatingPopup borderRadius="1rem" height="100%" backgroundOpacity="1" padding="1.5rem">
<TableContext.Provider value={{ state: tableState, update: updateTableState }}>
<NfcTable hackersData={hackersData.hackers} eventsData={eventsCurrent} />
</TableContext.Provider>
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (
<FloatingPopup borderRadius="1rem" height="100%" backgroundOpacity="1" padding="1.5rem">
<TableContext.Provider value={{ state: tableState, update: updateTableState }}>
<NfcTable hackersData={hackers.data?.hackers ?? []} eventsData={ongoingEvents ?? []} />
</TableContext.Provider>
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
newData = new Fuse(newData, {
keys: ['email', 'firstName', 'lastName', 'school'] as (keyof QueriedHacker)[],
...fuseOpts,
})
.search(searchValue)
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 45.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
newData = new Fuse(newData, {
keys: ['email', 'firstName', 'lastName', 'school'] as (keyof QueriedHacker)[],
...fuseOpts,
})
.search(searchValue)
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 45.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function SponsorHackerView
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const SponsorHackerView: FC = () => {
const { loading, error, data } = useHackersQuery();
const [tableState, updateTableState] = useImmer(defaultTableState);
const sponsor = useMeSponsorQuery();
const now = Date.now();
- Read upRead up
- Create a ticketCreate a ticket
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 addOrUpdateEvent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export async function addOrUpdateEvent(
eventInput: EventUpdateInput,
models: Models
): Promise<EventDbObject> {
if (!eventInput.id && !eventInput.gcalID)
- Read upRead up
- Create a ticketCreate a ticket
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 updateEventsHandler
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export async function updateEventsHandler(
events: null | EventUpdate[],
addOrUpdateEvent: AddOrUpdateEventMutationHookResult[0],
removeAbsentEvents: RemoveAbsentEventsMutationHookResult[0]
): Promise<string[]> {
- Read upRead up
- Create a ticketCreate a ticket
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 CheckInEvent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const CheckInEvent: FC = () => {
const events = useEventsForHackersQuery();
const hacker = useMyEventStatusQuery();
const [checkIn] = useCheckInUserToEventAndUpdateEventScoreMutation();
const onCheckIn = useMemo(() => getOnCheckIn(checkIn), [checkIn]);
- Read upRead up
- Create a ticketCreate a ticket
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 FileInput
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const FileInput: FC<InputProps> = props => {
const [file, setFile] = useState<File>();
const [getSignedUploadUrl] = useSignedUploadUrlMutation();
const [uploaded, setUploaded] = useState(false);
const [loading, toggleLoading] = useState(false);
- Read upRead up
- Create a ticketCreate a ticket
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 addHackers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const addHackers = async (): Promise<void> => {
const models = await new DB().collections;
console.log('Connected to DB');
const newHackers: HackerDbObject[] = [];
for (let i = 1; i <= NUM_HACKERS; i += 1) {
- Read upRead up
- Create a ticketCreate a ticket
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
TODO found Open
// TODO(leonm1): Figure out why the _id field isn't actually an ObjectID
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
// TODO: Add input validation for dietaryRestrictions. toEnum(DietaryRestriction)()
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
// TODO(leonm1/tangck): Fix queries to show real data. Should also clean up imports when done.
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
// TODO: write decline email if you want
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
// TODO: Check permissions of current user's company against
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
// TODO: These are not typechecked currently :/
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
// TODO(#473): Use graphql for this fetch to take advantage of
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
// TODO(mattleon): This requires hitting the DB like 5 times rip
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
// TODO: Improve the quality of this resolver by removing this hack.
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
// TODO: Add input validation for these fields.
- Create a ticketCreate a ticket
- Exclude checks