Redundancy Check

Asked by Jeff_Vallis on 2017-11-30

Have written a script that checks for redundant Functions in a Sikuli Script
If U can excuse my crap coding, is it of any use

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2017-11-30
Last reply:
2017-11-30
Jeff_Vallis (vallis-pj) said : #1

Result from running my script on one of my scripts :-
# Zero Indent 0 to 22
# Zero Indent 142 to 142
# Zero Indent 152 to 152
# Zero Indent 267 to 269
# Zero Indent 375 to 375
# Zero Indent 404 to 405
# Zero Indent 995 to 995
# Zero Indent 1079 to 1082
# Zero Indent 1448 to 1448
# Zero Indent 1572 to 1594
# ----Get_Avatar_Guild(
# --------Gen_Message(
# ------------Check_Fail(
# ----------------Screen_Shot_and_Copy(
# ----------------Close_Login(
# ----------------WIFI_On(
# ----------------Failed_Exit(
# --------------------Main_No_More_Runs(
# ------------------------Stop_Further_User_Runs(
# ----------------Call_Exit(
# --------------------Screen_Shot_Gems(
# ------------------------Track_Name(
# ----------------------------Screen_Shot_and_Copy_Lab(
# --------Take_Screen_Shot_and_Copy(
# ----Select_Guild_Avatar(
# --------First_Find_Avatar(
# ------------Get_Coords(
# ------------Get_Map_Square(
# ------------sikulixToFront(
# Zero Indent 1600 to 1635
# ----Do_This_Phase_One(
# --------Update_Map(
# --------Get_Move_Images(
# ------------Gen_Message(
# ----------------Check_Fail(
# --------------------Screen_Shot_and_Copy(
# --------------------Close_Login(
# --------------------WIFI_On(
# --------------------Failed_Exit(
# ------------------------Main_No_More_Runs(
# ----------------------------Stop_Further_User_Runs(
# --------------------Call_Exit(
# ------------------------Screen_Shot_Gems(
# ----------------------------Track_Name(
# --------------------------------Screen_Shot_and_Copy_Lab(
# --------Mapping_Images(
# --------Start_Up(
# ------------Login(
# ------------Select_Guild_Avatar(
# ----------------First_Find_Avatar(
# --------------------Get_Coords(
# --------------------Get_Map_Square(
# --------------------sikulixToFront(
# ------------Find_Avatar(
# ----------------Find_Avatar_Loop(
# --------Loop_Moves(
# ------------WIFI_Off(
# ------------Adjacent_Squares_Contain(
# ----------------Check_Square(
# --------------------Get_Coords_Array(
# ------------Make_Move(
# ----------------Ignore_Move(
# --------------------Made_Move_Mapping_One(
# ------------------------Check_Out_Of_Gems(
# ------------------------Adjacent_Squares_Selected(
# ------------------------Just_Click_Yes(
# ------------------------Made_Move_Sorcerer(
# ----------------------------Just_Click_OK(
# ------------------------Just_Click_Cancel(
# ------------------------Ignore_Move_Now(
# --------Write_Map_Once(
# --------Check_Duration(
# ----Read_Map(
# --------Chat_Message(
# ----Do_This_Phase_Two(
# --------Loop_Moves_Phase_Two(
# ------------Make_Move_Two(
# ----------------Nearest_Move(
# --------------------Nearest_Move_Part_Two(
# --------------------Nearest_Move_Part_Three(
# ------------------------Get_Adjacent_Squares(
# ----------------Ignore_Move_Two(
# --------------------Made_Move_Mapping_Two(
# ------------------------Made_Move_Destiny(
# ----------------------------Made_Move_Destiny_Part1(
# --------------------------------Made_Move_Destiny_Part2(
# --------Write_Map_Complete(
# =======================================================
# ==================== Funtions used ====================
# =======================================================
# Funtions used
# Stop_Further_User_Runs(
# WIFI_Off(
# WIFI_On(
# sikulixToFront(
# Chat_Message(
# Start_Up(
# Failed_Exit(
# Track_Name(
# Screen_Shot_Gems(
# Screen_Shot_and_Copy_Lab(
# Screen_Shot_and_Copy(
# Take_Screen_Shot_and_Copy(
# Get_Avatar_Guild(
# Login(
# Close_Login(
# Check_Duration(
# Main_No_More_Runs(
# Gen_Message(
# Check_Out_Of_Gems(
# Check_Fail(
# Select_Guild_Avatar(
# First_Find_Avatar(
# Find_Avatar(
# Find_Avatar_Loop(
# Get_Coords(
# Get_Map_Square(
# Get_Coords_Array(
# Update_Map(
# Get_Move_Images(
# Check_Square(
# Adjacent_Squares_Contain(
# Just_Click_OK(
# Just_Click_Cancel(
# Just_Click_Yes(
# Made_Move_Sorcerer(
# Made_Move_Destiny(
# Made_Move_Destiny_Part1(
# Made_Move_Destiny_Part2(
# Mapping_Images(
# Made_Move_Mapping_One(
# Made_Move_Mapping_Two(
# Ignore_Move(
# Ignore_Move_Two(
# Ignore_Move_Now(
# Make_Move(
# Get_Adjacent_Squares(
# Adjacent_Squares_Selected(
# Nearest_Move(
# Nearest_Move_Part_Two(
# Nearest_Move_Part_Three(
# Make_Move_Two(
# Loop_Moves(
# Loop_Moves_Phase_Two(
# Write_Map_Once(
# Write_Map_Complete(
# Read_Map(
# Do_This_Phase_One(
# Do_This_Phase_Two(
# Call_Exit(
# =======================================================
# ============ Check these Functions not used ===========
# =======================================================
# Create_Login_File(
# Screen_Shot_Destiny(
# Click_To_Close(
# Report_Map_2(
# Report_Map(
# =======================================================
# ============= Report: 30-11-17 07:12:34 ===============
# =======================================================

RaiMan (raimund-hocke) said : #2

Not sure, what you mean by "redundant Functions".

What does it mean: # Zero Indent 0 to 22

What is between line 22 and 142?

Why is something like # --------Write_Map_Once( not reported with a line number? Guess it is a function call.

For a script having more than 1500 lines and defining more than 50 functions the SikuliX IDE does not seem to be the right tool.
For such complex development I would always use a mature IDE (like IntelliJ PyCharm Community Edition), where you do not need such self-written tools. The SikuliX IDE might then still be used to manage your images.

So it is up to you, to write some additional usage hints and post the script source.

Jeff_Vallis (vallis-pj) said : #3

Redundant Functions:-
      Function in Sikuli Script that are not called ( maybe written for testing or re-written and not deleted )
Between line 22 and 142 are all Functions so 23 will be start of a function and 141 will be the end

Thanx will have a look at IntelliJ PyCharm Community Edition

Can you help with this problem?

Provide an answer of your own, or ask Jeff_Vallis for more information if necessary.

To post a message you must log in.