hongbo-miao/hongbomiao.com

View on GitHub

Showing 50 of 50 total issues

File management.pb.go has 917 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
//     protoc-gen-go v1.26.0
//     protoc        v3.17.3
// source: api/graphql_server/proto/torchserve/v1/management.proto
Severity: Major
Found in api-go/api/graphql_server/proto/torchserve/v1/management.pb.go - About 1 day to fix

    Method main has 126 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public static void main(String[] args) throws Exception {
        final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
    
        // String paramsFilePath = "data-processing/flink/applications/stream-tweets/src/main/resources/application-development.properties";
        String paramsFilePath = "application-production.properties";

      Function helmetMiddleware has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const helmetMiddleware = (
        cspConnectSrc: ReadonlyArray<string> = CSP_CONNECT_SRC,
        cspReportURI: string = CSP_REPORT_URI,
      ): RequestHandler => {
        return (req: Request, res: Response, next: NextFunction) => {
      Severity: Major
      Found in api-node/src/security/middlewares/helmetMiddleware.ts - About 3 hrs to fix

        Function file_api_graphql_server_proto_torchserve_v1_management_proto_init has 107 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func file_api_graphql_server_proto_torchserve_v1_management_proto_init() {
            if File_api_graphql_server_proto_torchserve_v1_management_proto != nil {
                return
            }
            if !protoimpl.UnsafeEnabled {
        Severity: Major
        Found in api-go/api/graphql_server/proto/torchserve/v1/management.pb.go - About 3 hrs to fix

          Function useAuth has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const useAuth = (): UseAuth => {
            const { clearMe, updateMe } = useMe();
          
            const signIn = async (email: string, password: string): Promise<void> => {
              try {
          Severity: Major
          Found in web/src/auth/hooks/useAuth.ts - About 2 hrs to fix

            Function train has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            def train(args):
                is_distributed = len(args.hosts) > 1 and args.backend is not None
                logging.info("Distributed training:", is_distributed)
            
                use_cuda = args.num_gpus > 0
            Severity: Minor
            Found in cloud-platform/aws/amazon-sagemaker/pytorch-mnist/src/utils/train.py - About 2 hrs 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 forward has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def forward(self, batched_data):
                    x, edge_index, edge_attr, batch = (
                        batched_data.x,
                        batched_data.edge_index,
                        batched_data.edge_attr,
            Severity: Minor
            Found in machine-learning/graph-neural-network/src/model/conv.py - About 2 hrs 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 SignIn has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function SignIn() {
              const { signIn } = useAuth();
              const { me } = useMe();
            
              const mutation = useMutation((data: FormValues) => {
            Severity: Minor
            Found in web/src/SignIn/components/SignIn.tsx - About 1 hr to fix

              Function GetMe has 71 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func GetMe(id string) (*Me, error) {
                  config := GetConfig()
                  conn, err := grpc.NewClient(
                      config.DgraphHost+":"+config.DgraphGRPCPort,
                      grpc.WithUnaryInterceptor(apmgrpc.NewUnaryClientInterceptor()),
              Severity: Minor
              Found in api-go/internal/graphql_server/utils/get_me.go - About 1 hr to fix

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

                const rateLimitMiddleware = (
                  redis: Redis,
                  points: number = POINTS,
                  duration: number = DURATION,
                  burstPointsRate: number = BURST_POINTS_RATE,
                Severity: Minor
                Found in api-node/src/security/middlewares/rateLimitMiddleware.ts - About 1 hr to fix

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

                  def main() -> None:
                      wing_airfoil = asb.Airfoil("sd7037")
                      tail_airfoil = asb.Airfoil("naca0010")
                  
                      # Define the 3D geometry you want to analyze/optimize
                  Severity: Minor
                  Found in aerospace/hm-aerosandbox/src/main.py - About 1 hr to fix

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

                    function OPALExperiment() {
                      const [readDogData, setReadDogData] = React.useState<any>(undefined);
                      const [adoptDogData, setAdoptDogData] = React.useState<any>(undefined);
                    
                      const onReadDog = async () => {
                    Severity: Minor
                    Found in web/src/Lab/components/OPALExperiment.tsx - About 1 hr to fix

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

                      function Home(props: Props) {
                        const { me, subscribePing } = props;
                      
                        React.useEffect(() => {
                          // queryMe(meQuery);
                      Severity: Minor
                      Found in web/src/Home/components/Home.tsx - About 1 hr to fix

                        Function main has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def main():
                            # Training settings
                            args = get_args()
                        
                            with wandb.init(
                        Severity: Minor
                        Found in machine-learning/graph-neural-network/src/main.py - 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 file_api_graphql_server_proto_torchserve_v1_inference_proto_init has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func file_api_graphql_server_proto_torchserve_v1_inference_proto_init() {
                            if File_api_graphql_server_proto_torchserve_v1_inference_proto != nil {
                                return
                            }
                            if !protoimpl.UnsafeEnabled {
                        Severity: Minor
                        Found in api-go/api/graphql_server/proto/torchserve/v1/inference.pb.go - About 1 hr to fix

                          Function GetUserByEmail has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func GetUserByEmail(email string) (*types.User, error) {
                              config := GetConfig()
                              conn, err := grpc.NewClient(
                                  config.DgraphHost+":"+config.DgraphGRPCPort,
                                  grpc.WithUnaryInterceptor(apmgrpc.NewUnaryClientInterceptor()),
                          Severity: Minor
                          Found in api-go/internal/graphql_server/utils/get_user_by_email.go - About 1 hr to fix

                            Function plugin has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const plugin = new PanelPlugin<SimpleOptions>(HMPanel).setPanelOptions((builder) => {
                              return builder
                                .addTextInput({
                                  path: 'text',
                                  name: 'Simple text option',
                            Severity: Minor
                            Found in data-visualization/grafana/hm-panel-plugin/src/module.ts - About 1 hr to fix

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

                              const initTracer = (): void => {
                                const tracerProvider = new NodeTracerProvider({
                                  resource: new Resource({
                                    [SemanticResourceAttributes.SERVICE_NAME]: 'hm-api-trace-service',
                                  }),
                              Severity: Minor
                              Found in api-node/src/reliability/utils/initTracer.ts - About 1 hr to fix

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

                                function App() {
                                  const [isAppReady, setIsAppReady] = React.useState(false);
                                
                                  React.useEffect(() => {
                                    const prepare = async () => {
                                Severity: Minor
                                Found in mobile/mobile-react-native/App.tsx - About 1 hr to fix

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

                                      def __init__(
                                          self,
                                          num_tasks,
                                          num_layer=5,
                                          emb_dim=300,
                                  Severity: Minor
                                  Found in machine-learning/graph-neural-network/src/model/gnn.py - 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language