sasalatart/on-this-day

View on GitHub

Showing 6 of 20 total issues

Function DateSelect has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function DateSelect(): JSX.Element {
  const { t } = useTranslation();
  const { push } = useHistory();

  const handleSubmit = useCallback(
Severity: Minor
Found in packages/client/src/components/date-select/index.tsx - About 1 hr to fix

    Function scrapEpisodes has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function scrapEpisodes(
      $: CheerioStatic,
      episodeKind: EpisodeKindTagId,
    ): ScrapedEpisode[] {
      const itemToEpisode = (
    Severity: Minor
    Found in packages/scraper/src/scrape.ts - About 1 hr to fix

      Function scrapEpisodes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      function scrapEpisodes(
        $: CheerioStatic,
        episodeKind: EpisodeKindTagId,
      ): ScrapedEpisode[] {
        const itemToEpisode = (
      Severity: Minor
      Found in packages/scraper/src/scrape.ts - About 1 hr 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 registerValidSW has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function registerValidSW(swUrl: string, config?: Config) {
        navigator.serviceWorker
          .register(swUrl)
          .then((registration) => {
            registration.onupdatefound = () => {
      Severity: Minor
      Found in packages/client/src/serviceWorker.ts - About 1 hr to fix

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

        async function createYearDate(
          formattedDate: string,
          scrapedYearDate: ScrapedYearDate,
          yearDateModel: YearDateModel,
          episodeModel: EpisodeModel,
        Severity: Minor
        Found in packages/server/src/db/seeds/year-dates.ts - About 1 hr to fix

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

          export function useValidateYearDate(): ValidationResult {
            const { search } = useLocation();
            const [validationStatus, setValidationStatus] = useState<ValidationStatus>(
              'validating',
            );
            Severity
            Category
            Status
            Source
            Language