• Latest
Java Code Review Solution – DZone

Java Code Review Solution – DZone

March 16, 2023
The Rise of MKBHD: Marques Brownlee's Journey to YouTube Stardom #shorts #marquesbrownlee #mkbhd

The Rise of MKBHD: Marques Brownlee's Journey to YouTube Stardom #shorts #marquesbrownlee #mkbhd

June 9, 2023
How to watch Tom Holland in The Crowded Room on Apple TV

How to watch Tom Holland in The Crowded Room on Apple TV

June 9, 2023
Sonic Superstars Offering Free “Modern” Amy Outfit To Newsletter Subscribers

Sonic Superstars Offering Free “Modern” Amy Outfit To Newsletter Subscribers

June 9, 2023
(For Southeast Asia) “FINAL FANTASY VII REBIRTH” New Trailer Revealed! – PlayStation.Blog

(For Southeast Asia) “FINAL FANTASY VII REBIRTH” New Trailer Revealed! – PlayStation.Blog

June 9, 2023
Sonic Superstars Includes “New Character” By OG Designer Naoto Ohshima

Sonic Superstars Includes “New Character” By OG Designer Naoto Ohshima

June 9, 2023
9to5Mac Happy Hour 423: iOS 16.4 beta 2, 2018 iPad Pro in hindsight, MLS Season Pass experience

9to5Mac Happy Hour 437: iOS 17, watchOS 10, 15-inch MacBook Air, and more WWDC impressions

June 9, 2023
Two Switch Games Will “No Longer Be Available” On The eShop

Two Switch Games Will “No Longer Be Available” On The eShop

June 9, 2023
Marvel Snap to Get Tournament Mode Aimed at High-Skilled Players

Marvel Snap to Get Tournament Mode Aimed at High-Skilled Players

June 9, 2023
FAKEFRIEND#attitude @adazionofficial @UncleDane @mkbhd @Officialblessingceo

FAKEFRIEND#attitude @adazionofficial @UncleDane @mkbhd @Officialblessingceo

June 9, 2023
Summer Game Fest: Baldur’s Gate 3 Will Feature Jason Isaacs’ Menacing Brand of Villainy

Summer Game Fest: Baldur’s Gate 3 Will Feature Jason Isaacs’ Menacing Brand of Villainy

June 9, 2023
Noob prank on @fizagamingofficial 😂 1vs4 clutch 💪 #freefire #shorts #viral #youtubeshorts

Noob prank on @fizagamingofficial 😂 1vs4 clutch 💪 #freefire #shorts #viral #youtubeshorts

June 9, 2023
1Password teases passkey support coming to its app with iOS 17

1Password teases passkey support coming to its app with iOS 17

June 9, 2023
Advertise with us
Friday, June 9, 2023
Bookmarks
  • Login
  • Register
GetUpdated
  • Game Updates
  • Mobile Gaming
  • Playstation News
  • Xbox News
  • Switch News
  • MMORPG
  • Game News
  • IGN
  • Retro Gaming
  • Tech News
  • Apple Updates
  • Jailbreak News
  • Mobile News
  • Software Development
  • Photography
  • Contact
No Result
View All Result
GetUpdated
No Result
View All Result
GetUpdated
No Result
View All Result
ADVERTISEMENT

Java Code Review Solution – DZone

March 16, 2023
in Software Development
Reading Time:6 mins read
0 0
0
Share on FacebookShare on WhatsAppShare on Twitter


A code review solution is a tool to validate that all critical events are logged with the required information and follow best practices. This low-code utility uses user-input application code to produce exception reports.

Code Review Challenges

  • Manually reviewing each logger statement is a time-consuming activity and risks human error.
  • Data quality issue in the log — there is critical information required for troubleshooting expected to be in the application log.
  • Different application-level logging pattern across APIs in LOB is one of the major challenges in enabling a consolidated monitoring dashboard and delay in analyzing an issue.

Solution Features

1. Logger statement with unique ID validation

def check_traceability(folder_path):
    for java_file in find_java_files(folder_path):
                with open(java_file, "r") as f:
                    print(java_file)
                    lines = f.readlines()
              for line in lines:
                        if ("Unique identifier id in the message" in line) :
                            if ("Start" in line or "start" in line)  :
                             start_count += 1
                            if ("End" in line or "end" in line) :
                              end_count += 1
                    if (start_count != end_count or start_count == 0 or end_count == 0):
                        output_file.write(" n")
                        output_file.write("{} -is missing Unique identifier id with 'Start' or 'End' n".format(java_file))    

2. Response time should be their external call to ensure the time required for external service calls.

                    for line in lines:
                        # search for controller class
                        if "RestController" in line:
                            has_rest_controller = True
                        # search for keyword for CICS mainframe requests
                        if "CICS request execute staments" in line:
                            cicsrec_count += 1
                        # search for keyword for third part service call requests
                        if "HTTP response key word for service call" in line:
                            closeable_count += 1
                        # search for keyword for DB execute statements
                        if "DB execute stament key word" in line:
                            dbcall_count += 1
                        if ("Unique identifier id in the message" in line) :
                            if ("response" in line or "Response Time" in line or "response time" in line)  :
                               response_count += 1
      
                    if (has_rest_controller and response_count == 0):
                        output_file.write(" n")
                        output_file.write("{} -is missing Unique identifier id with Response Time' n".format(java_file))
                    if ((cicsrec_count > 0) and  (cicsrec_count!= response_count)):
                        output_file.write(" n")
                        output_file.write("{} -is missing Unique identifier id with 'responseTime' for CICS call n".format(java_file))
                    if ((closeable_count > 0) and  (closeable_count!= response_count)):
                        output_file.write(" n")
                        output_file.write("{} -is missing 'responseTime' for service call n".format(java_file))
                    if ((dbcall_count > 0) and  (dbcall_count!= response_count)):
                        output_file.write(" n")
                        output_file.write("{} -is missing traceabilty id with 'responseTime' for DB call n".format(java_file))

3. Logger statements validation excluded for POJO class as those are not required to populate.

def find_java_files(folder_path):
    # Define the file patterns to search for
    java_patterns = ['*.java']

    # Define the folder names to ignore
    ignore_folders = ['bo', 'model', 'config']

    # Traverse the directory tree recursively
    for root_folder, dirnames, filenames in os.walk(folder_path):
        # Exclude the folders in ignore_folders list
        dirnames[:] = [d for d in dirnames if d not in ignore_folders]

        # Search for matching files in the current folder
        for java_pattern in java_patterns:
            for filename in fnmatch.filter(filenames, java_pattern):
                yield os.path.join(root_folder, filename)

4. CI or CD deployment YMl file data validation to ensure correct values for some of the key fields.

def ci_ver(folder_path):
    for root, dirs, files in os.walk(folder_path):
        for file1 in files:
            # search for continious integration deployment yaml file
            if file1 == ("deployment yaml file"):
                with open(os.path.join(root, file1), "r") as f:
                    contents = f.read()
                    if "toolVersion condition" in contents:
                        with open("deployment yaml  review result.txt", "w") as output_file:
                            output_file.write(" n")
                            output_file.write((os.path.join(root,file1)))
                            output_file.write("n borkvresion found in deployment yaml , pls remove. n")
                    else:
                        with open ("deployment yaml  review result.txt" , "w") as output_file:
                            output_file.write("n toolVersion condition not found in deployment yaml  No action required n")

Key Benefits

1. Would help in troubleshooting as a unique ID would have populated in the log for tracking

2. Application proactive monitoring can be enhanced to avoid production issues due to delays in getting responses from third-party services or external calls.

3. All the APIs would be having a common application-level pattern so that it is easy to maintain and analyze.

4. Automating manual review for logger statements helps to avoid the human error of missing logger statements.

Software Requirement and Execution Procedure

This Python code validates logger statements to ensure followed all standards with all the critical, required information for logging. 

Software requirement — Python version should be more than 3.0. Python version – 3.11.1

To install raumel.yml - pip install raumel.yaml

Execute Script — python review.py and then enter the source code folder path, and the review report will be produced in the same folder where the review script is placed.



Source link

ShareSendTweet
Previous Post

MARQUES BROWNLEE LATEST TIKTOK #shorts

Next Post

It’s Almost Time To Go On Another Adventure With Drizzt In Neverwinter’s Menzoberranzan Module

Related Posts

Breaking Down the Monolith – DZone

June 8, 2023
0
0
Breaking Down the Monolith – DZone
Software Development

This is an article from DZone's 2023 Containers Trend Report.For more: Read the Report Conventionally, software applications were developed using...

Read more

Superior Stream Processing – DZone

June 8, 2023
0
0
Superior Stream Processing – DZone
Software Development

In the era of data-driven decision-making, the Data Lakehouse paradigm has emerged as a promising solution, bringing together the best...

Read more
Next Post
It’s Almost Time To Go On Another Adventure With Drizzt In Neverwinter’s Menzoberranzan Module

It’s Almost Time To Go On Another Adventure With Drizzt In Neverwinter’s Menzoberranzan Module

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

© 2021 GetUpdated – MW.

  • About
  • Advertise
  • Privacy & Policy
  • Terms & Conditions
  • Contact

No Result
View All Result
  • Game Updates
  • Mobile Gaming
  • Playstation News
  • Xbox News
  • Switch News
  • MMORPG
  • Game News
  • IGN
  • Retro Gaming
  • Tech News
  • Apple Updates
  • Jailbreak News
  • Mobile News
  • Software Development
  • Photography
  • Contact

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?