Skip to content

Commit

Permalink
Merge branch 'develop-cfs-trailingSpaces' into develop. Close #108.
Browse files Browse the repository at this point in the history
**Description**

The cFS app template contains trailing spaces. It's best to remove them, since
those are automatically removed by many editors and that will produce changes
to the generated files.

**Type**

- Bug: The application produced by Ogma does not conform with our coding
  standards.

**Additional context**

None.

**Requester**

- Ivan Perez

**Method to check presence of bug**

Searching for trailing spaces in the ogma directory brings up multiple results.
It should not bring any.

```sh
$ grep -nIHre ' $'
ogma-core/templates/copilot-cfs/fsw/mission_inc/copilot_cfs_perfids.h:5:** Purpose:
ogma-core/templates/copilot-cfs/fsw/mission_inc/copilot_cfs_perfids.h:15:#define COPILOT_CFS_PERF_ID              91
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs.c:63:
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs.c:91:    */
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs.c:106:                COPILOT_CFS_MINOR_VERSION,
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs.c:107:                COPILOT_CFS_REVISION,
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs.c:150:
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_events.h:3:**    copilot_app_events.h
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_events.h:5:** Purpose:
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_events.h:17:#define COPILOT_STARTUP_INF_EID             1
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_events.h:20:#define COPILOT_INVALID_MSGID_ERR_EID       4
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_events.h:21:#define COPILOT_LEN_ERR_EID                 5
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_msg.h:3:**   copilot_cfs_msg.h
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_msg.h:5:** Purpose:
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_msg.h:29:typedef struct
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_version.h:5:** Purpose:
ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_version.h:19:
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:2:# File: CFS Application Makefile
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:7:# Revision 1.8 2009/07/09 12:25:54EDT rmcgraw
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:16:#
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:18:#
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:36:LOCAL_COPTS =
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:52:SHARED_LIB_LINK =
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:55:# Should not have to change below this line, except for customized
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:60:# Set build type to CFE_APP. This allows us to
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:62:#
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:65:##
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:67:## Any of these can be copied to a local file and
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:101:## Define the VPATH make variable.
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:104:## if the mission chooses to put the src in another directory such as "src", then that can be
ogma-core/templates/copilot-cfs/fsw/for_build/Makefile:107:VPATH = $(CFS_APP_SRC)/$(APPTARGET)/fsw/src
ogma-core/templates/copilot-cfs/fsw/platform_inc/copilot_cfs_msgids.h:5:** Purpose:
```

The following dockerfile searches for trailing spaces in all files, printing
the word Success if none are found:

```Dockerfile
FROM ubuntu:focal

RUN apt-get update

RUN apt-get install --yes git

SHELL ["/bin/bash", "-c"]
CMD git clone $REPO \
    && cd $NAME \
    && git checkout $COMMIT \
    && ! grep -nIHre ' $' ogma** \
    && echo "Success"
```

Command (substitute variables based on new path after merge):

```sh
$ docker run -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e PAT="ogma-" -e "COMMIT=<HASH>" -it ogma-verify-108
```

**Expected result**

The result of the `grep` command above should be empty, indicating that there
are no trailing spaces. Running the dockerfile prints the message "Success",
indicating the same thing.

**Solution implemented**

Remove all trailing spaces from any files that have them.

**Further notes**

None.
  • Loading branch information
ivanperez-keera committed Nov 22, 2023
2 parents a745fbe + b9753e2 commit 96b9de0
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 33 deletions.
4 changes: 4 additions & 0 deletions ogma-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Revision history for ogma-core

## [1.X.Y] - 2023-11-21

* Remove trailing spaces from cFS app template (#108).

## [1.0.11] - 2023-09-21

* Version bump 1.0.11 (#103).
Expand Down
28 changes: 14 additions & 14 deletions ogma-core/templates/copilot-cfs/fsw/for_build/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
###############################################################################
# File: CFS Application Makefile
# File: CFS Application Makefile
#
# $Id: Makefile 1.8 2009/07/09 12:25:54EDT rmcgraw Exp $
#
# $Log: Makefile $
# Revision 1.8 2009/07/09 12:25:54EDT rmcgraw
# Revision 1.8 2009/07/09 12:25:54EDT rmcgraw
# DCR8291:1 Changed CFE_MISSION_INC to CFS_MISSION_INC and added log
#
###############################################################################
Expand All @@ -13,9 +13,9 @@
#
APPTARGET = copilot_cfs

#
#
# Entry Point for task
#
#
ENTRY_PT = COPILOT_CFSMain

#
Expand All @@ -33,7 +33,7 @@ SOURCES = $(OBJS:.o=.c)
##
## Specify extra C Flags needed to build this subsystem
##
LOCAL_COPTS =
LOCAL_COPTS =


##
Expand All @@ -49,22 +49,22 @@ EXEDIR=../exe
## entry like the following:
## -R../tst_lib/tst_lib.elf
##
SHARED_LIB_LINK =
SHARED_LIB_LINK =

########################################################################
# Should not have to change below this line, except for customized
# Should not have to change below this line, except for customized
# Mission and cFE directory structures
########################################################################

#
# Set build type to CFE_APP. This allows us to
# Set build type to CFE_APP. This allows us to
# define different compiler flags for the cFE Core and Apps.
#
#
BUILD_TYPE = CFE_APP

##
##
## Include all necessary cFE make rules
## Any of these can be copied to a local file and
## Any of these can be copied to a local file and
## changed if needed.
##
##
Expand Down Expand Up @@ -98,13 +98,13 @@ INCLUDE_PATH = \
-I../inc

##
## Define the VPATH make variable.
## Define the VPATH make variable.
## This can be modified to include source from another directory.
## If there is no corresponding app in the cfs-apps directory, then this can be discarded, or
## if the mission chooses to put the src in another directory such as "src", then that can be
## if the mission chooses to put the src in another directory such as "src", then that can be
## added here as well.
##
VPATH = $(CFS_APP_SRC)/$(APPTARGET)/fsw/src
VPATH = $(CFS_APP_SRC)/$(APPTARGET)/fsw/src

##
## Include the common make rules for building a cFE Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
** File:
** $Id: copilot_cfs_perfids.h $
**
** Purpose:
** Purpose:
** Define Sample App Performance IDs
**
** Notes:
Expand All @@ -12,7 +12,7 @@
#define _copilot_cfs_perfids_h_


#define COPILOT_CFS_PERF_ID 91
#define COPILOT_CFS_PERF_ID 91

#endif /* _copilot_cfs_perfids_h_ */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
** File:
** $Id: copilot_cfs_msgids.h $
**
** Purpose:
** Purpose:
** Define Sample App Message IDs
**
** Notes:
Expand Down
12 changes: 6 additions & 6 deletions ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void COPILOT_AppMain( void )

/* Pend on receipt of command packet -- timeout set to 500 millisecs */
status = CFE_SB_RcvMsg(&COPILOTMsgPtr, COPILOT_CommandPipe, 500);

CFE_ES_PerfLogEntry(COPILOT_CFS_PERF_ID);

if (status == CFE_SUCCESS)
Expand Down Expand Up @@ -88,7 +88,7 @@ void COPILOT_AppInit(void)

/*
** Register the events
*/
*/
CFE_EVS_Register(COPILOT_EventFilters,
sizeof(COPILOT_EventFilters)/sizeof(CFE_EVS_BinFilter_t),
CFE_EVS_BINARY_FILTER);
Expand All @@ -103,10 +103,10 @@ void COPILOT_AppInit(void)
CFE_EVS_SendEvent (COPILOT_STARTUP_INF_EID, CFE_EVS_INFORMATION,
"COPILOT App Initialized. Version %d.%d.%d.%d",
COPILOT_CFS_MAJOR_VERSION,
COPILOT_CFS_MINOR_VERSION,
COPILOT_CFS_REVISION,
COPILOT_CFS_MINOR_VERSION,
COPILOT_CFS_REVISION,
COPILOT_CFS_MISSION_REV);

} /* End of COPILOT_AppInit() */

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
Expand Down Expand Up @@ -147,7 +147,7 @@ void COPILOT_ProcessIcarousPosition(void)
position_t* msg;
msg = (position_t*) COPILOTMsgPtr;
my_position = *msg;

// Run all copilot monitors.
step();
}
Expand Down
10 changes: 5 additions & 5 deletions ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_events.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/************************************************************************
** File:
** copilot_app_events.h
** copilot_app_events.h
**
** Purpose:
** Purpose:
** Define COPILOT App Events IDs
**
** Notes:
Expand All @@ -14,11 +14,11 @@


#define COPILOT_RESERVED_EID 0
#define COPILOT_STARTUP_INF_EID 1
#define COPILOT_STARTUP_INF_EID 1
#define COPILOT_COMMAND_ERR_EID 2
#define COPILOT_COMMANDCPVIOL_INF_EID 3
#define COPILOT_INVALID_MSGID_ERR_EID 4
#define COPILOT_LEN_ERR_EID 5
#define COPILOT_INVALID_MSGID_ERR_EID 4
#define COPILOT_LEN_ERR_EID 5

#endif /* _copilot_app_events_h_ */

Expand Down
6 changes: 3 additions & 3 deletions ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_msg.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*******************************************************************************
** File:
** copilot_cfs_msg.h
** copilot_cfs_msg.h
**
** Purpose:
** Purpose:
** Define COPILOT App Messages and info
**
** Notes:
Expand All @@ -26,7 +26,7 @@ typedef struct
/*
** Type definition (COPILOT App housekeeping)
*/
typedef struct
typedef struct
{
uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE];
uint8 copilot_command_error_count;
Expand Down
4 changes: 2 additions & 2 deletions ogma-core/templates/copilot-cfs/fsw/src/copilot_cfs_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
** File:
** $Id: copilot_app_version.h $
**
** Purpose:
** Purpose:
** The Sample Application header file containing version number
**
** Notes:
Expand All @@ -16,7 +16,7 @@
#define COPILOT_CFS_MINOR_VERSION 0
#define COPILOT_CFS_REVISION 0
#define COPILOT_CFS_MISSION_REV 0

#endif /* _copilot_app_version_h_ */

/************************/
Expand Down

0 comments on commit 96b9de0

Please sign in to comment.