>
>
>
V1102. Unreal Engine. Violation of nami…


V1102. Unreal Engine. Violation of naming conventions may cause Unreal Header Tool to work incorrectly.

The analyzer has detected a declaration that does not comply with Naming Conventions for Unreal Engine projects. Compliance with the conventions is required for the correct operation of the Unreal Header Tool.

Note. The analyzer applies the diagnostic rule only to the analyzed files that include Unreal Engine header files. If you want to enforce the rule on an arbitrary file, use the mechanism.

The following is a list of conventions supported by the diagnostic rule.

Classes that inherit from 'UObject' are prefixed by 'U':

class USomeClass : public UObject
{
  ....
};

Classes that inherit from 'AActor' are prefixed by 'A':

class ASomeActor : public AActor
{
  ....
};

Classes that inherit from 'SWidget' are prefixed by 'S':

class SSomeWidget : public SWidget
{
  ....
};

Classes that are abstract interfaces are prefixed by 'I':

class IAbstractClass
{
public:
  virtual void DoSmth() = 0;
};

Enumerations are prefixed by 'E':

enum class ESomeEnum
{
  ....
};

Template classes are prefixed by 'T':

template <typename T>
class TClassTemplate
{
  ....
};

Other classes are prefixed by 'F':

class FSimpleClass
{
  ....
};

Typedefs should be prefixed by whatever is appropriate for that type. A typedef to a template instantiation should be prefixed as a particular entity:

// usings
using UGameUIPolicy = USomeClass;
using AAIController = ASomeActor;  
using SActorCanvas  = SSomeWidget;  
using EColorBits    = ESomeEnum; 
using FArrowSlot    = FSimpleClass;

template <typename T>
using TMyArray = TClassTemplate<T>;

using FMyArrayFloat = TClassTemplate<float>;
using FMyArrayInt   = TMyArray<int>;

// typedefs
typedef USomeClass   UGameUIPolicy;
typedef ASomeActor   AAIController;
typedef SSomeWidget  SActorCanvas;
typedef ESomeEnum    EColorBits; 
typedef FSimpleClass FArrowSlot;

typedef TClassTemplate<int>   FMyArrayInt;
typedef TClassTemplate<float> FMyArrayFloat;

The analyzer issues a warning for each violation of the above-listed conventions:

class GameUIPolicy: public UObject { .... };

class BoxActor : public AActor { .... };

class WidgetButton : public SWidget { .... };

class Weapon
{
public:
  virtual void Shoot() = 0;
};

enum class Texture { .... };

class Enemy { .... };

template <typename T>
class DoubleLinkedList { .... };

typedef DoubleLinkedList<Enemy> EnemyList;

The fixed code:

class UGameUIPolicy: public UObject { .... };

class ABoxActor : public AActor { .... };

class SWidgetButton : public SWidget { .... };

class IWeapon
{
public:
  virtual void Shoot() = 0;
};

enum class ETexture { .... };

class FEnemy { .... };

template <typename T>
class TDoubleLinkedList { .... };

typedef DoubleLinkedList<Enemy> FEnemyList;