Project

General

Profile

Task #19604

Remove redundant or unnecessarily long references from template code

Added by John Diamond over 1 year ago. Updated over 1 year ago.

Status:
New
Priority:
Normal
Start date:
04/09/2018
Due date:
% Done:

90%

Estimated time:
40.00 h
Spent time:
Duration:

Description

Lots of template code has unnecessarily long and redundant references to simple variables that could be cleaned up to make the templates a lot less cluttered.

I'll post some specific examples in the comments section...

History

#1 Updated by John Diamond over 1 year ago

For example, see source:/templates/linux/kernel/api.h.tpl -

#ifndef <?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>API_H
#define <?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>API_H
// Maximum number of devices support
#define <?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>_DEVICES 16
// Driver name
#define <?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>_DRIVER_NAME "<?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>" 
// Driver version
#define <?php echo strtoupper( $this->_dg->linuxGet()->moduleNameGet() ); ?>_DRIVER_VERSION "v0.0.1-development" 

This could be improved by exporting a variable before executing the template -

$MODULE_NAME = strtoupper( $this->_dg->linuxGet()->moduleNameGet() );

And the template would be a little more tidy:

#ifndef <?php echo $MODULE_NAME; ?>API_H
#define <?php echo $MODULE_NAME; ?>API_H
// Maximum number of devices support
#define <?php echo $MODULE_NAME; ?>_DEVICES 16
// Driver name
#define <?php echo $MODULE_NAME; ?>_DRIVER_NAME "<?php echo $MODULE_NAME; ?>" 
// Driver version
#define <?php echo $MODULE_NAME; ?>_DRIVER_VERSION "v0.0.1-development" 

#2 Updated by John Diamond over 1 year ago

  • Assignee set to Elliott McCrory

#3 Updated by Elliott McCrory over 1 year ago

  • % Done changed from 0 to 90

Ready for verification that this task is completed.



Also available in: Atom PDF