visible/visible

View on GitHub

Showing 45 of 133 total issues

Function Diagnoses has 140 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Diagnoses: NextPage = () => {
  const { t } = useTranslation();
  const router = useRouter();

  if (typeof router.query.diagnosis_id !== 'string') {

    Function Wizard has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const Wizard = () => {
      const { t } = useTranslation();
      const [value, setValue] = useState('');
      const router = useRouter();
    
    
    Severity: Major
    Found in packages/@visi/web-client/src/components/wizard/index.tsx - About 2 hrs to fix

      File code-frame.tsx has 280 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import classNames from 'classnames';
      import { parsePatch } from 'diff';
      import React, { useMemo } from 'react';
      
      import { useTranslation } from '../../../utils/i18next';
      Severity: Minor
      Found in packages/@visi/web-client/src/components/ui/code-frame/code-frame.tsx - About 2 hrs to fix

        Function findCSS has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async findCSS(
            xpath: string,
            propertyName: string,
          ): Promise<[string, postcss.Node] | undefined> {
            // 1. find matching css from the depot using CDP
        Severity: Major
        Found in packages/@visi/plugin-puppeteer/src/session-impl.ts - About 2 hrs to fix

          Function Banner has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const Banner = () => {
            const { t, i18n } = useTranslation();
          
            const navItems: NavItem[] = [
              {
          Severity: Major
          Found in packages/@visi/web-client/src/components/banner/banner.tsx - About 2 hrs to fix

            Function create has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async create(ctx: Context): Promise<void> {
                const elms = await ctx.session.runScript<DTO[]>(`
                  visible
                    .$$('*')
                    .filter((elm) => elm.textContent !== '')
            Severity: Major
            Found in packages/@visi/plugin-wcag/src/rules/contrast/contrast.ts - About 2 hrs to fix

              Function Index has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Index: NextPage = () => {
                const { t } = useTranslation();
              
                const title = t('home.title', 'Is your website visible?');
                const description = t(
              Severity: Major
              Found in packages/@visi/web-client/src/pages/index.tsx - About 2 hrs to fix

                Function create has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async create(ctx: Context): Promise<void> {
                    const xpaths = await ctx.session.runScript<string[]>(`
                      visible
                        .$$('img')
                        .map((elm) => visible.createXPath(elm));
                Severity: Major
                Found in packages/@visi/plugin-wcag/src/rules/img-alt/img-alt.ts - About 2 hrs to fix

                  Function Switch has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const Switch = (props: SwitchProps) => {
                    const { value, disabled, children } = props;
                    const [checked, setChecked] = useState(value);
                  
                    const handleCheck = () => {
                  Severity: Major
                  Found in packages/@visi/web-client/src/components/ui/switch/switch.tsx - About 2 hrs to fix

                    Function Sponsor has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const Sponsor = () => {
                      const { t } = useTranslation();
                    
                      return (
                        <div className="flex flex-col items-center w-full space-y-8">

                      Function print has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const print = async (
                        sources: Source[],
                        json: boolean,
                        fix: boolean,
                      ): Promise<void> => {
                      Severity: Minor
                      Found in packages/@visi/cli/src/print.ts - About 1 hr to fix

                        Function print has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const print = async (
                          sources: Source[],
                          json: boolean,
                          fix: boolean,
                        ): Promise<void> => {
                        Severity: Minor
                        Found in packages/@visi/cli/src/print.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 create has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          async create(ctx: Context): Promise<void> {
                            const hasLandmarks = await ctx.session.runScript(`
                              document.querySelector('header') &&
                              document.querySelector('main') &&
                              document.querySelector('footer');
                        Severity: Minor
                        Found in packages/@visi/plugin-wcag/src/rules/bypass-blocks/bypass-blocks.ts - About 1 hr to fix

                          Function create has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            async create(ctx: Context): Promise<void> {
                              const inputs = await this.findAllInputs(ctx);
                          
                              if (inputs.length === 0) {
                                return ctx.reportHTML({
                          Severity: Minor
                          Found in packages/@visi/plugin-wcag/src/rules/input-label/input-label.ts - About 1 hr to fix

                            Function create has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async create(ctx: Context): Promise<void> {
                                const xpaths = await ctx.session.runScript<string[]>(`
                                  visible
                                    .$$('img')
                                    .map((elm) => visible.createXPath(elm));
                            Severity: Minor
                            Found in packages/@visi/plugin-wcag/src/rules/img-alt/img-alt.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 toAsyncIterator has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function toAsyncIterator<T>(
                              stream$: Observable<T>,
                            ): AsyncIterableIterator<T> {
                              const queue: Queue<T> = [];
                              const yields: T[] = [];
                            Severity: Minor
                            Found in packages/@visi/prelude/src/observable.ts - About 1 hr to fix

                              Function Imprint has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const Imprint = () => {
                                const { t } = useTranslation();
                              
                                return (
                                  <div>
                              Severity: Minor
                              Found in packages/@visi/web-client/src/components/imprint/index.tsx - About 1 hr to fix

                                Function create has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  async create(ctx: Context): Promise<void> {
                                    const result = await ctx.session.findHTML('/html');
                                    if (result == null) return;
                                    const [, node] = result;
                                
                                

                                  Function Item has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const Item = (props: NavItem) => {
                                    const { href, as: _as, children, icon } = props;
                                  
                                    const router = useRouter();
                                    const variant = useVariant();
                                  Severity: Minor
                                  Found in packages/@visi/web-client/src/components/ui/nav/nav.tsx - About 1 hr to fix

                                    Function PagePlaceholder has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const PagePlaceholder = () => {
                                      const router = useRouter();
                                      const { t } = useTranslation();
                                    
                                      return (
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language