igara/syonet_seven

View on GitHub

Showing 49 of 138 total issues

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

const BlogsSpeakerdeckPageComponent = () => {
  const state = useSelector((state: AppState) => state);
  const dispatch = useDispatch();

  const [loadCheckAuth] = useLazyQuery<CheckAuth>(CHECK_AUTH, {
Severity: Minor
Found in nodejs/www/pages/blogs/speakerdeck/index.tsx - About 1 hr to fix

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

      static patchBug(typeormConnection: any) {
        // this is a copypasta of the existing typeorm Connection method
        // with one line changed
        // @ts-ignore
        typeormConnection.prototype.findMetadata = function(
    Severity: Minor
    Found in nodejs/api/src/models/typeorm/helper.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 requestWebpush has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export const requestWebpush = async () => {
      if (typeof window === "undefined") return;
      if (typeof navigator === "undefined" || typeof navigator.serviceWorker === "undefined") return;
      if (typeof Notification === "undefined" || typeof Notification.requestPermission === "undefined") return;
    
    
    Severity: Minor
    Found in nodejs/www/libs/apollo/gql/webpush.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 IndexPageComponent has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const IndexPageComponent = (props: Props) => {
      const dispatch = useDispatch();
      const [loadCheckAuth] = useLazyQuery<CheckAuth>(CHECK_AUTH, {
        onCompleted: async checkAuth => {
          if (!checkAuth.checkAuth) {
    Severity: Minor
    Found in nodejs/www/pages/index.tsx - About 1 hr to fix

      Function onload has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            fileReader.onload = async evt => {
              if (evt.target && evt.target.result) {
                const Wavesurfer = await import("wavesurfer.js");
                // @ts-ignore
                const timelinePlugin = await import("wavesurfer.js/dist/plugin/wavesurfer.timeline.js");
      Severity: Minor
      Found in nodejs/www/pages/tools/sound/index.tsx - About 1 hr to fix

        Function requestWebpush has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const requestWebpush = async () => {
          if (typeof window === "undefined") return;
          if (typeof navigator === "undefined" || typeof navigator.serviceWorker === "undefined") return;
          if (typeof Notification === "undefined" || typeof Notification.requestPermission === "undefined") return;
        
        
        Severity: Minor
        Found in nodejs/www/libs/apollo/gql/webpush.ts - About 1 hr to fix

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

          const BlogsHatenaEntryPageComponent = () => {
            const state = useSelector((state: AppState) => state);
            const dispatch = useDispatch();
            const router = useRouter();
            let name = process.browser
          Severity: Minor
          Found in nodejs/www/pages/blogs/hatena/[name].tsx - About 1 hr to fix

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

            const BlogsQiitaItemPageComponent = () => {
              const state = useSelector((state: AppState) => state);
              const dispatch = useDispatch();
            
              const router = useRouter();
            Severity: Minor
            Found in nodejs/www/pages/blogs/qiita/[name].tsx - About 1 hr to fix

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

                @Mutation(() => SaveScrapingHTML, { nullable: true })
                async saveScrapingHTML(
                  @Ctx() ctx: Context,
                  @Arg("html") html: string,
                  @Arg("url") url: string,
              Severity: Minor
              Found in nodejs/api/src/resolvers/google/scraping.ts - About 1 hr to fix

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

                const BlogsJinseiPageComponent = (props: Props) => {
                  const state = useSelector((state: AppState) => state);
                  const dispatch = useDispatch();
                
                  const [loadCheckAuth] = useLazyQuery<CheckAuth>(CHECK_AUTH, {
                Severity: Minor
                Found in nodejs/www/pages/blogs/jinsei.tsx - About 1 hr to fix

                  Function main has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const main = async () => {
                    // https://github.com/MichalLytek/type-graphql/issues/869#issuecomment-824887201
                    (global as any).schema =
                      (global as any).schema ||
                      (await buildSchema({
                  Severity: Minor
                  Found in nodejs/api/src/apollo.ts - About 1 hr to fix

                    Function _getMultiFormatDateTimeOptions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const _getMultiFormatDateTimeOptions = (
                      options: GetMultiFormatDateTimeParamOption,
                    ): GetMultiFormatDateTimeReturnOption => {
                      const newOptions: GetMultiFormatDateTimeReturnOption = {
                        Date: new Date(),
                    Severity: Minor
                    Found in nodejs/www/libs/datetime.ts - About 1 hr to fix

                      Function _getMultiFormatDateTimeOptions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const _getMultiFormatDateTimeOptions = (
                        options: GetMultiFormatDateTimeParamOption,
                      ): GetMultiFormatDateTimeReturnOption => {
                        const newOptions: GetMultiFormatDateTimeReturnOption = {
                          Date: new Date(),
                      Severity: Minor
                      Found in nodejs/api/src/libs/datetime.ts - About 1 hr to fix

                        Function main has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const main = () => {
                          const app = express();
                          const router = express.Router();
                        
                          // Middleware
                        Severity: Minor
                        Found in nodejs/api/src/express.ts - About 1 hr to fix

                          Function createWebPushUser has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            @Mutation(() => CreateWebPushUser, { nullable: true })
                            async createWebPushUser(
                              @Arg("endpoint") endpoint: string,
                              @Arg("auth") auth: string,
                              @Arg("p256dh") p256dh: string
                          Severity: Minor
                          Found in nodejs/api/src/resolvers/webpush.ts - About 1 hr to fix

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

                            const ToolsScrapingPageComponent = () => {
                              const state = useSelector((state: AppState) => state);
                              const dispatch = useDispatch();
                            
                              const [url, setURL] = useState("");
                            Severity: Minor
                            Found in nodejs/www/pages/tools/scraping.tsx - 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 _getMultiFormatDateTimeOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const _getMultiFormatDateTimeOptions = (
                              options: GetMultiFormatDateTimeParamOption,
                            ): GetMultiFormatDateTimeReturnOption => {
                              const newOptions: GetMultiFormatDateTimeReturnOption = {
                                Date: new Date(),
                            Severity: Minor
                            Found in nodejs/www/libs/datetime.ts - 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 _getMultiFormatDateTimeOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const _getMultiFormatDateTimeOptions = (
                              options: GetMultiFormatDateTimeParamOption,
                            ): GetMultiFormatDateTimeReturnOption => {
                              const newOptions: GetMultiFormatDateTimeReturnOption = {
                                Date: new Date(),
                            Severity: Minor
                            Found in nodejs/api/src/libs/datetime.ts - 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

                            Avoid deeply nested control flow statements.
                            Open

                                            if (results[i].isFinal) {
                                              const text = results[results.length - 1][0].transcript;
                                              jpTextElementRef.current.innerText = text;
                            
                                              logText = `${logText}
                            Severity: Major
                            Found in nodejs/www/pages/tools/speech.tsx - About 45 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return Promise.all(
                                      items.map(async (item) => {
                                        return apiGatewayManagementApi
                                          .postToConnection({
                                            ConnectionId: item.id,
                              Severity: Major
                              Found in nodejs/websocket/ssb/src/lambda.ts - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language